
    i(                     :   d Z ddl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rddlmZ  G d d	e          Z G d
 de          Z G d de          Z G d de          Z G d de          Z G d de          Z G d de          Z G d de          ZdS )zFThis module contains objects representing Telegram bot command scopes.    )TYPE_CHECKINGFinal)	constants)TelegramObject)enum)JSONDict)Botc                       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d
z  f fdZeddedddd f fd            Z x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                    t                                          |           t          j        t          j        ||          | _        | j        f| _        |                                  d S )Nr   )	super__init__r   
get_memberr   BotCommandScopeTyper   	_id_attrs_freeze)selfr   r   	__class__s      Y/Users/shanyulin/my-agent/.venv/lib/python3.11/site-packages/telegram/_botcommandscope.pyr   zBotCommandScope.__init__P   sR    J///)FdSS	)    databotz
Bot | Nonereturnc                    |                      |          }| j        t          | j        t          | j        t          | j        t          | j	        t          | j        t          | j        t          i}| t          u rG|                    d          |v r0||                    d                                       ||          S t'                                          ||          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.

        r   )r!   r"   )_parse_datar   BotCommandScopeDefaultr   BotCommandScopeAllPrivateChatsr   BotCommandScopeAllGroupChatsr   $BotCommandScopeAllChatAdministratorsr   BotCommandScopeChatr   !BotCommandScopeChatAdministratorsr   BotCommandScopeChatMemberr   getpopde_jsonr   )clsr!   r"   _class_mappingr   s       r   r/   zBotCommandScope.de_jsonW   s    " t$$ K/!#A!=')MH)#%FO6<
 /!!dhhv&6&6.&H&H!$((6"2"23;;3;OOOwwDc222r    )N)__name__
__module____qualname____doc__	__slots__r   r   r   r   str__annotations__r   r   r   r   r   r   r   r   classmethodr/   __classcell__r   s   @r   r   r   !   s         : I#7?GU3Z???A$-$A$SuSzSSSK"+"?"OOU3ZOOOI*3*G*_U3Z___Q 49D%*999>&/&C&WsWWWM';GKsGGGECG   S D       3 38 3, 3BS 3 3 3 3 3 [3 3 3 3 3r    r   c                   8     e Zd ZdZdZdddedz  f fdZ x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`.
     Nr   r   c                    t                                          t          j        |           |                                  d S Nr   r   )r   r   r   r   r   r   r   r   s     r   r   zBotCommandScopeDefault.__init__   s4    o5*MMMr    r2   r3   r4   r5   r6   r   r   r:   r;   s   @r   r&   r&   y   sf          I8<   ho          r    r&   c                   8     e Zd ZdZdZdddedz  f fdZ xZS )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                    t                                          t          j        |           |                                  d S r?   )r   r   r   r   r   rA   s     r   r   z'BotCommandScopeAllPrivateChats.__init__   s4    o?JWWWr    rB   r;   s   @r   r'   r'      sf          I8<   ho          r    r'   c                   8     e Zd ZdZdZdddedz  f fdZ xZS )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                    t                                          t          j        |           |                                  d S r?   )r   r   r   r   r   rA   s     r   r   z%BotCommandScopeAllGroupChats.__init__   s4    o=*UUUr    rB   r;   s   @r   r(   r(      f          I8<   ho          r    r(   c                   8     e Zd ZdZdZdddedz  f fdZ xZS )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                    t                                          t          j        |           |                                  d S r?   )r   r   r   r   r   rA   s     r   r   z-BotCommandScopeAllChatAdministrators.__init__   s5    oER\]]]r    rB   r;   s   @r   r)   r)      rG   r    r)   c                   B     e Zd ZdZdZdddeez  dedz  f fdZ x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   rL   r   c                b   t                                          t          j        |           |                                 5  t          |t                    r|                    d          r|nt          |          | _	        | j
        | j	        f| _        d d d            d S # 1 swxY w Y   d S Nr@   @)r   r   r   r   	_unfrozen
isinstancer7   
startswithintrL   r   r   r   rL   r   r   s      r   r   zBotCommandScopeChat.__init__   s    o2zJJJ^^ 	7 	7%gs33a8J8J38O8OaUXY`UaUa L #i6DN		7 	7 	7 	7 	7 	7 	7 	7 	7 	7 	7 	7 	7 	7 	7 	7 	7 	7   AB$$B(+B(
r2   r3   r4   r5   r6   r7   rS   r   r   r:   r;   s   @r   r*   r*      q          ILP 7 7 7c	 7(T/ 7 7 7 7 7 7 7 7 7 7r    r*   c                   B     e Zd ZdZdZdddeez  dedz  f fdZ xZ	S )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|
    rK   Nr   rL   r   c                b   t                                          t          j        |           |                                 5  t          |t                    r|                    d          r|nt          |          | _	        | j
        | j	        f| _        d d d            d S # 1 swxY w Y   d S rN   )r   r   r   r   rP   rQ   r7   rR   rS   rL   r   r   rT   s      r   r   z*BotCommandScopeChatAdministrators.__init__   s    oAjYYY^^ 	7 	7%gs33a8J8J38O8OaUXY`UaUa L #i6DN		7 	7 	7 	7 	7 	7 	7 	7 	7 	7 	7 	7 	7 	7 	7 	7 	7 	7rU   rV   r;   s   @r   r+   r+      rW   r    r+   c                   F     e Zd ZdZdZdddeez  dededz  f fdZ x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.
    )rL   user_idNr   rL   r[   r   c                |   t                                          t          j        |           |                                 5  t          |t                    r|                    d          r|nt          |          | _	        || _
        | j        | j	        | j
        f| _        d d d            d S # 1 swxY w Y   d S rN   )r   r   r   r   rP   rQ   r7   rR   rS   rL   r[   r   r   )r   rL   r[   r   r   s       r   r   z"BotCommandScopeChatMember.__init__  s   o9jQQQ^^ 	E 	E%gs33a8J8J38O8OaUXY`UaUa L !(DL"it|DDN	E 	E 	E 	E 	E 	E 	E 	E 	E 	E 	E 	E 	E 	E 	E 	E 	E 	Es   A!B11B58B5rV   r;   s   @r   r,   r,      s         $ 'IZ^ E E Ec	 EC ESW E E E E E E E E E Er    r,   N)r5   typingr   r   telegramr   telegram._telegramobjectr   telegram._utilsr   telegram._utils.typesr   r	   r   r&   r'   r(   r)   r*   r+   r,   r=   r    r   <module>rb      s  ( M L ' ' ' ' ' ' ' '       3 3 3 3 3 3             * * * * * * U3 U3 U3 U3 U3n U3 U3 U3p    _   $    _        ?       ?   7 7 7 7 7/ 7 7 767 7 7 7 7 7 7 76E E E E E E E E E Er    