L i2)dZddlmZmZmZmZddlmZddlm Z ddl m Z ddl m Z erddlmZGdd e ZGd d eZGd d eZGddeZGddeZGddeZGddeZGddeZy)zFThis module contains objects representing Telegram bot command scopes.) TYPE_CHECKINGFinalOptionalUnion) constants)TelegramObject)enum)JSONDict)BotceZdZUdZdZej jZee e d< ej jZ ee e d< ej jZ ee e d< ej jZ ee e d< ej jZee e d< ej jZee e d< ej j Zee e d < d d d e d eeffdZeddededddffd ZxZS)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. )typeDEFAULTALL_PRIVATE_CHATSALL_GROUP_CHATSALL_CHAT_ADMINISTRATORSCHATCHAT_ADMINISTRATORS CHAT_MEMBERN api_kwargsrrct||tjtj |||_|j f|_|jy)Nr) super__init__r get_memberrBotCommandScopeTyper _id_attrs_freeze)selfrr __class__s _/mnt/ssd/data/python-lab/Trading/venv/lib/python3.12/site-packages/telegram/_botcommandscope.pyrzBotCommandScope.__init__PsC J/)F)FdS )) databotr returnc|j|}|jt|jt|j t |jt|jt|jt|jti}|tur8|j!d|vr%||j#dj%||St&|I||S)a6Converts 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_datarBotCommandScopeDefaultrBotCommandScopeAllPrivateChatsrBotCommandScopeAllGroupChatsr$BotCommandScopeAllChatAdministratorsrBotCommandScopeChatr!BotCommandScopeChatAdministratorsrBotCommandScopeChatMemberr getpopde_jsonr)clsr#r$_class_mappingr s r!r1zBotCommandScope.de_jsonWs"t$ KK/  ! !#A   !=  ' ')M HH)  # #%F OO6<  / !dhhv&6.&H!$((6"23;;3;O OwDc22r")N)__name__ __module__ __qualname____doc__ __slots__rrrrstr__annotations__rrrrrrrr r classmethodr1 __classcell__r s@r!r r !s&:I#77??GU3Z?A$-$A$A$S$SuSzSK"+"?"?"O"OOU3ZOI*3*G*G*_*_U3Z_Q 4499D%*9>&/&C&C&W&WsWM';;GGKsGEFJS(1C383(5/3EV33r"r c8eZdZdZdZdddeeffdZxZS)r(aoRepresents 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`. Nrrcdt|tj||j yNrr)rrr rrrrr s r!rzBotCommandScopeDefault.__init__s$ o55*M r" r4r5r6r7r8rr rr<r=s@r!r(r(ys(I;?hx&8r"r(c8eZdZdZdZdddeeffdZxZS)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?Nrrcdt|tj||j yrA)rrr rrrCs r!rz'BotCommandScopeAllPrivateChats.__init__s$ o??JW r"rDr=s@r!r)r)s(I;?hx&8r"r)c8eZdZdZdZdddeeffdZxZS)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?Nrrcdt|tj||j yrA)rrr rrrCs r!rz%BotCommandScopeAllGroupChats.__init__s$ o==*U r"rDr=s@r!r*r*(I;?hx&8r"r*c8eZdZdZdZdddeeffdZxZS)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?Nrrcdt|tj||j yrA)rrr rrrCs r!rz-BotCommandScopeAllChatAdministrators.__init__s% oEER\] r"rDr=s@r!r+r+rIr"r+cFeZdZdZdZdddeeefdee ffdZ xZ S)r,aRepresents 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_idNrrNrc.t|tj||j 5t |t r|jdr|n t||_ |j|jf|_ dddy#1swYyxYwNrB@) rrr r _unfrozen isinstancer9 startswithintrNrrrrNrr s r!rzBotCommandScopeChat.__init__sy o22zJ ^^  7%gs38J8J38OUXY`Ua L#ii6DN  7 7 7 AB  B r4r5r6r7r8rr9rUrr rr<r=s@r!r,r,7 IUY7c3h7@R77r"r,cFeZdZdZdZdddeeefdee ffdZ xZ 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| rMNrrNrc.t|tj||j 5t |t r|jdr|n t||_ |j|jf|_ dddy#1swYyxYwrP) rrr rrRrSr9rTrUrNrrrVs r!rz*BotCommandScopeChatAdministrators.__init__sy oAAjY ^^  7%gs38J8J38OUXY`Ua L#ii6DN  7 7 7rWrXr=s@r!r-r-rYr"r-cJeZdZdZdZdddeeefdedee ffdZ xZ S) r.aRepresents 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. )rNuser_idNrrNr]rcRt|tj||j 5t |t r|jdr|n t||_ ||_ |j|j|jf|_ dddy#1swYyxYwrP) rrr rrRrSr9rTrUrNr]rr)rrNr]rr s r!rz"BotCommandScopeChatMember.__init__s o99jQ ^^  E%gs38J8J38OUXY`Ua L!(DL"iit||DDN  E E Es A#BB&rXr=s@r!r.r.sJ$'I[_ ES#X E14 EEMhEW E Er"r.N)r7typingrrrrtelegramrtelegram._telegramobjectrtelegram._utilsr telegram._utils.typesr r r r(r)r*r+r,r-r.r?r"r!rds(M883 *U3nU3p_$ _  ?  ? 7/76776EEr"