o
    /h)                     @   s   d Z ddlmZmZmZmZmZmZ ddlm	Z	 ddl
mZ ddlmZ ddlmZ er2ddlmZ G dd	 d	eZG d
d deZG dd deZG dd deZG dd deZG dd deZG dd deZG dd deZdS )zFThis module contains objects representing Telegram bot command scopes.    )TYPE_CHECKINGDictFinalOptionalTypeUnion)	constants)TelegramObject)enum)JSONDict)Botc                	       s  e Zd ZU dZdZejjZee	 e
d< 	 ejjZee	 e
d< 	 ejjZee	 e
d< 	 ejjZee	 e
d< 	 ejjZee	 e
d< 	 ejjZee	 e
d< 	 ejjZee	 e
d	< 	 d
dde	dee f fddZe	
ddee ded ded  f fddZ  ZS )BotCommandScopea/  Base class for objects that represent the scope to which bot commands are applied.
    Currently, the following 7 scopes are supported:

    * :class:`telegram.BotCommandScopeDefault`
    * :class:`telegram.BotCommandScopeAllPrivateChats`
    * :class:`telegram.BotCommandScopeAllGroupChats`
    * :class:`telegram.BotCommandScopeAllChatAdministrators`
    * :class:`telegram.BotCommandScopeChat`
    * :class:`telegram.BotCommandScopeChatAdministrators`
    * :class:`telegram.BotCommandScopeChatMember`

    Objects of this class are comparable in terms of equality. Two objects of this class are
    considered equal, if their :attr:`type` is equal. For subclasses with additional attributes,
    the notion of equality is overridden.

    Note:
        Please see the `official docs`_ on how Telegram determines which commands to display.

    .. _`official docs`: https://core.telegram.org/bots/api#determining-list-of-commands

    .. versionadded:: 13.7

    Args:
        type (:obj:`str`): Scope type.

    Attributes:
        type (:obj:`str`): Scope type.
    )typeDEFAULTALL_PRIVATE_CHATSALL_GROUP_CHATSALL_CHAT_ADMINISTRATORSCHATCHAT_ADMINISTRATORSCHAT_MEMBERN
api_kwargsr   r   c                   s6   t  j|d ttj||| _| jf| _|   d S )Nr   )	super__init__r
   
get_memberr   BotCommandScopeTyper   	_id_attrs_freeze)selfr   r   	__class__ R/var/www/html/govbot/env/lib/python3.10/site-packages/telegram/_botcommandscope.pyr   O   s   
zBotCommandScope.__init__databotr   returnc                    s~   |  |}|s	dS | jt| jt| jt| jt| j	t
| jt| jti}| tu r7|d|v r7||d j||dS t j||dS )a6  Converts JSON data to the appropriate :class:`BotCommandScope` object, i.e. takes
        care of selecting the correct subclass.

        Args:
            data (Dict[:obj:`str`, ...]): The JSON data.
            bot (:class:`telegram.Bot`, optional): The bot associated with this object. Defaults to
                :obj:`None`, in which case shortcut methods will not be available.

                .. versionchanged:: 21.4
                   :paramref:`bot` is now optional and defaults to :obj:`None`

        Returns:
            The Telegram object.

        Nr   )r#   r$   )_parse_datar   BotCommandScopeDefaultr   BotCommandScopeAllPrivateChatsr   BotCommandScopeAllGroupChatsr   $BotCommandScopeAllChatAdministratorsr   BotCommandScopeChatr   !BotCommandScopeChatAdministratorsr   BotCommandScopeChatMemberr   getpopde_jsonr   )clsr#   r$   _class_mappingr   r!   r"   r0   V   s   

zBotCommandScope.de_json)N)__name__
__module____qualname____doc__	__slots__r   r   r   r   str__annotations__r   r   r   r   r   r   r   r   r   classmethodr0   __classcell__r!   r!   r   r"   r       s6   
  r   c                       4   e Zd ZdZdZdddee f fddZ  ZS )r'   ao  Represents the default scope of bot commands. Default commands are used if no commands with
    a `narrower scope`_ are specified for the user.

    .. _`narrower scope`: https://core.telegram.org/bots/api#determining-list-of-commands

    .. versionadded:: 13.7
    Attributes:
        type (:obj:`str`): Scope type :tg-const:`telegram.BotCommandScope.DEFAULT`.
    r!   Nr   r   c                      t  jtj|d |   d S Nr   r   )r   r   r   r   r   r   r   r   r!   r"   r         zBotCommandScopeDefault.__init__	r3   r4   r5   r6   r7   r   r   r   r;   r!   r!   r   r"   r'   }   s    
$r'   c                       r<   )r(   zRepresents the scope of bot commands, covering all private chats.

    .. versionadded:: 13.7

    Attributes:
        type (:obj:`str`): Scope type :tg-const:`telegram.BotCommandScope.ALL_PRIVATE_CHATS`.
    r!   Nr   r   c                   r=   r>   )r   r   r   r   r   r@   r   r!   r"   r      rA   z'BotCommandScopeAllPrivateChats.__init__rB   r!   r!   r   r"   r(      s    $r(   c                       r<   )r)   zRepresents the scope of bot commands, covering all group and supergroup chats.

    .. versionadded:: 13.7
    Attributes:
        type (:obj:`str`): Scope type :tg-const:`telegram.BotCommandScope.ALL_GROUP_CHATS`.
    r!   Nr   r   c                   r=   r>   )r   r   r   r   r   r@   r   r!   r"   r      rA   z%BotCommandScopeAllGroupChats.__init__rB   r!   r!   r   r"   r)          $r)   c                       r<   )r*   zRepresents the scope of bot commands, covering all group and supergroup chat administrators.

    .. versionadded:: 13.7
    Attributes:
        type (:obj:`str`): Scope type :tg-const:`telegram.BotCommandScope.ALL_CHAT_ADMINISTRATORS`.
    r!   Nr   r   c                   r=   r>   )r   r   r   r   r   r@   r   r!   r"   r      rA   z-BotCommandScopeAllChatAdministrators.__init__rB   r!   r!   r   r"   r*      rC   r*   c                       @   e Zd ZdZdZdddeeef dee	 f fddZ
  ZS )	r+   a  Represents the scope of bot commands, covering a specific chat.

    Objects of this class are comparable in terms of equality. Two objects of this class are
    considered equal, if their :attr:`type` and :attr:`chat_id` are equal.

    .. versionadded:: 13.7

    Args:
        chat_id (:obj:`str` | :obj:`int`): |chat_id_group|

    Attributes:
        type (:obj:`str`): Scope type :tg-const:`telegram.BotCommandScope.CHAT`.
        chat_id (:obj:`str` | :obj:`int`): |chat_id_group|
    chat_idNr   rF   r   c                   p   t  jtj|d |  ! t|tr|dr|nt|| _	| j
| j	f| _W d    d S 1 s1w   Y  d S Nr?   @)r   r   r   r   	_unfrozen
isinstancer8   
startswithintrF   r   r   r   rF   r   r   r!   r"   r         
"zBotCommandScopeChat.__init__r3   r4   r5   r6   r7   r   r8   rM   r   r   r   r;   r!   r!   r   r"   r+          0r+   c                       rD   )	r,   a(  Represents the scope of bot commands, covering all administrators of a specific group or
    supergroup chat.

    Objects of this class are comparable in terms of equality. Two objects of this class are
    considered equal, if their :attr:`type` and :attr:`chat_id` are equal.

    .. versionadded:: 13.7

    Args:
        chat_id (:obj:`str` | :obj:`int`): |chat_id_group|
    Attributes:
        type (:obj:`str`): Scope type :tg-const:`telegram.BotCommandScope.CHAT_ADMINISTRATORS`.
        chat_id (:obj:`str` | :obj:`int`): |chat_id_group|
    rE   Nr   rF   r   c                   rG   rH   )r   r   r   r   rJ   rK   r8   rL   rM   rF   r   r   rN   r   r!   r"   r      rO   z*BotCommandScopeChatAdministrators.__init__rP   r!   r!   r   r"   r,      rQ   r,   c                       sD   e Zd ZdZdZdddeeef dedee	 f fdd	Z
  ZS )
r-   a  Represents the scope of bot commands, covering a specific member of a group or supergroup
    chat.

    Objects of this class are comparable in terms of equality. Two objects of this class are
    considered equal, if their :attr:`type`, :attr:`chat_id` and :attr:`user_id` are equal.

    .. versionadded:: 13.7

    Args:
        chat_id (:obj:`str` | :obj:`int`): |chat_id_group|
        user_id (:obj:`int`): Unique identifier of the target user.

    Attributes:
        type (:obj:`str`): Scope type :tg-const:`telegram.BotCommandScope.CHAT_MEMBER`.
        chat_id (:obj:`str` | :obj:`int`): |chat_id_group|
        user_id (:obj:`int`): Unique identifier of the target user.
    )rF   user_idNr   rF   rR   r   c                   sz   t  jtj|d |  & t|tr|dr|nt|| _	|| _
| j| j	| j
f| _W d    d S 1 s6w   Y  d S rH   )r   r   r   r   rJ   rK   r8   rL   rM   rF   rR   r   r   )r   rF   rR   r   r   r!   r"   r     s   
"z"BotCommandScopeChatMember.__init__rP   r!   r!   r   r"   r-      s    
r-   N)r6   typingr   r   r   r   r   r   telegramr   telegram._telegramobjectr	   telegram._utilsr
   telegram._utils.typesr   r   r   r'   r(   r)   r*   r+   r,   r-   r!   r!   r!   r"   <module>   s     ]