
    > /i5(                        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 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y)zFThis module contains objects representing Telegram bot command scopes.    )TYPE_CHECKINGDictFinalOptionalTypeUnion)	constants)TelegramObject)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e   f fdZedee   ddde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                x    t         |   |       || _        | j                  f| _        | j	                          y )Nr   )super__init__r   	_id_attrs_freeze)selfr   r   	__class__s      O/srv/sistema/bot/venv/lib/python3.12/site-packages/telegram/_botcommandscope.pyr   zBotCommandScope.__init__N   s0    J/	))    databotr   returnc                    | j                  |      }|sy| j                  t        | j                  t        | j
                  t        | j                  t        | j                  t        | j                  t        | j                  t        i}| t        u r8|j!                  d      |v r%||j#                  d         j%                  ||      S t&        | I  ||      S )aT  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`): The bot associated with this object.

        Returns:
            The Telegram object.

        Nr   )r"   r#   )_parse_datar   BotCommandScopeDefaultr   BotCommandScopeAllPrivateChatsr   BotCommandScopeAllGroupChatsr   $BotCommandScopeAllChatAdministratorsr   BotCommandScopeChatr   !BotCommandScopeChatAdministratorsr   BotCommandScopeChatMemberr   getpopde_jsonr   )clsr"   r#   _class_mappingr   s       r    r0   zBotCommandScope.de_jsonU   s     t$ KK/!!#A!='')MHH)##%FOO6<
 /!dhhv&6.&H!$((6"23;;3;OOwDc22r!   )__name__
__module____qualname____doc__	__slots__r	   BotCommandScopeTyper   r   str__annotations__r   r   r   r   r   r   r   r   r   classmethodr0   __classcell__r   s   @r    r   r      s,   : I#77??GU3Z?A$-$A$A$S$SuSzSK"+"?"?"O"OOU3ZOI*3*G*G*_*_U3Z_Q 4499D%*9>&/&C&C&W&WsWM';;GGKsGEFJ S (1C  38H- 3E 3hGX>Y 3 3r!   r   c                   8     e Zd ZdZdZdddee   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                d    t         |   t        j                  |       | j	                          y Nr   r   )r   r   r   r   r   r   r   r   s     r    r   zBotCommandScopeDefault.__init__   s$    o55*Mr!   	r3   r4   r5   r6   r7   r   r   r   r<   r=   s   @r    r'   r'   v   s(     I;? hx&8  r!   r'   c                   8     e Zd ZdZdZdddee   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                d    t         |   t        j                  |       | j	                          y rA   )r   r   r   r   r   rC   s     r    r   z'BotCommandScopeAllPrivateChats.__init__   s$    o??JWr!   rD   r=   s   @r    r(   r(      s(     I;? hx&8  r!   r(   c                   8     e Zd ZdZdZdddee   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                d    t         |   t        j                  |       | j	                          y rA   )r   r   r   r   r   rC   s     r    r   z%BotCommandScopeAllGroupChats.__init__   s$    o==*Ur!   rD   r=   s   @r    r)   r)      (     I;? hx&8  r!   r)   c                   8     e Zd ZdZdZdddee   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                d    t         |   t        j                  |       | j	                          y rA   )r   r   r   r   r   rC   s     r    r   z-BotCommandScopeAllChatAdministrators.__init__   s%    oEER\]r!   rD   r=   s   @r    r*   r*      rI   r!   r*   c                   F     e Zd ZdZdZdddeeef   dee	   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   rN   r   c                .   t         |   t        j                  |       | j	                         5  t        |t              r|j                  d      r|n
t        |      | _	        | j                  | j                  f| _        d d d        y # 1 sw Y   y xY wNrB   @)r   r   r   r   	_unfrozen
isinstancer9   
startswithintrN   r   r   r   rN   r   r   s      r    r   zBotCommandScopeChat.__init__   sy    o22zJ^^ 	7%gs38J8J38OUXY`Ua L #ii6DN		7 	7 	7   ABBr3   r4   r5   r6   r7   r   r9   rU   r   r   r   r<   r=   s   @r    r+   r+      7     IUY 7c3h 7@R 7 7r!   r+   c                   F     e Zd ZdZdZdddeeef   dee	   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|
    rM   Nr   rN   r   c                .   t         |   t        j                  |       | j	                         5  t        |t              r|j                  d      r|n
t        |      | _	        | j                  | j                  f| _        d d d        y # 1 sw Y   y xY wrP   )r   r   r   r   rR   rS   r9   rT   rU   rN   r   r   rV   s      r    r   z*BotCommandScopeChatAdministrators.__init__   sy    oAAjY^^ 	7%gs38J8J38OUXY`Ua L #ii6DN		7 	7 	7rW   rX   r=   s   @r    r,   r,      rY   r!   r,   c                   J     e Zd ZdZdZdddeeef   dedee	   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.
    )rN   user_idNr   rN   r]   r   c                R   t         |   t        j                  |       | j	                         5  t        |t              r|j                  d      r|n
t        |      | _	        || _
        | j                  | j                  | j                  f| _        d d d        y # 1 sw Y   y xY wrP   )r   r   r   r   rR   rS   r9   rT   rU   rN   r]   r   r   )r   rN   r]   r   r   s       r    r   z"BotCommandScopeChatMember.__init__  s     	o99jQ^^ 	E%gs38J8J38OUXY`Ua L !(DL"iit||DDN	E 	E 	Es   A#BB&rX   r=   s   @r    r-   r-      sJ    $ 'I [_	ES#X	E14	EEMhEW	E 	Er!   r-   N)r6   typingr   r   r   r   r   r   telegramr	   telegram._telegramobjectr
   telegram._utils.typesr   r   r   r'   r(   r)   r*   r+   r,   r-   r?   r!   r    <module>rc      s   ( M D D  3 *T3n T3n_ $_  ? ? 7/ 767 76E Er!   