L idZddlmZmZmZddlmZddlmZddl m Z ddl m Z ddl mZddlmZerdd lmZGd d eZGd d eZGddeZGddeZy)z>This module contains objects related to Telegram menu buttons.) TYPE_CHECKINGFinalOptional) constants)TelegramObject)enum)de_json_optional)JSONDict) WebAppInfo)Botc eZdZUdZdZdddedeeffdZe dded ed d dffd Z e jjZ eeed < e jj Zeeed< e jj"Zeeed<xZS) MenuButtonaThis object describes the bot's menu button in a private chat. It should be one of * :class:`telegram.MenuButtonCommands` * :class:`telegram.MenuButtonWebApp` * :class:`telegram.MenuButtonDefault` If a menu button other than :class:`telegram.MenuButtonDefault` is set for a private chat, then it is applied in the chat. Otherwise the default menu button is applied. By default, the menu button opens the list of bot commands. 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. .. versionadded:: 20.0 Args: type (:obj:`str`): Type of menu button that the instance represents. Attributes: type (:obj:`str`): Type of menu button that the instance represents. )typeN api_kwargsrrct||tjtj |||_|j f|_|jy)Nr) super__init__r get_memberrMenuButtonTyper _id_attrs_freeze)selfrr __class__s Z/mnt/ssd/data/python-lab/Trading/venv/lib/python3.12/site-packages/telegram/_menubutton.pyrzMenuButton.__init__<sE J/)A)A4N )) databotr returnc,|j|}|jt|jt|j t i}|tur8|jd|vr%||jdj||St|)||S)a1Converts JSON data to the appropriate :class:`MenuButton` 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)rrr) _parse_dataCOMMANDSMenuButtonCommandsWEB_APPMenuButtonWebAppDEFAULTMenuButtonDefaultrgetpopde_jsonr)clsrr_class_mappingrs rr+zMenuButton.de_jsonIs"t$ LL, KK) KK*7  * &!1^!C!$((6"23;;Dc;J JwDc22rr#r%r'N)__name__ __module__ __qualname____doc__ __slots__strrr r classmethodr+rrr#r__annotations__r%r' __classcell__rs@rrr"s.I *.  X& 383(5/3\338%33<`_. Objects of this class are comparable in terms of equality. Two objects of this class are considered equal, if their :attr:`type`, :attr:`text` and :attr:`web_app` are equal. .. versionadded:: 20.0 Args: text (:obj:`str`): Text of the button. web_app (:class:`telegram.WebAppInfo`): Description of the Web App that will be launched when the user presses the button. The Web App will be able to send an arbitrary message on behalf of the user using the method :meth:`~telegram.Bot.answerWebAppQuery` of :class:`~telegram.Bot`. Alternatively, a ``t.me`` link to a Web App of the bot can be specified in the object instead of the Web App's URL, in which case the Web App will be opened as if the user pressed the link. Attributes: type (:obj:`str`): :tg-const:`telegram.constants.MenuButtonType.WEB_APP`. text (:obj:`str`): Text of the button. web_app (:class:`telegram.WebAppInfo`): Description of the Web App that will be launched when the user presses the button. The Web App will be able to send an arbitrary message on behalf of the user using the method :meth:`~telegram.Bot.answerWebAppQuery` of :class:`~telegram.Bot`. Alternatively, a ``t.me`` link to a Web App of the bot can be specified in the object instead of the Web App's URL, in which case the Web App will be opened as if the user pressed the link. )textweb_appNrr@rArct|tjj||j 5||_||_|j|j |jf|_ dddy#1swYyxYwr<) rrrrr% _unfrozenr@rArr)rr@rArrs rrzMenuButtonWebApp.__init__sl i66>>:V ^^  B!DI'.DL"iiDLLADN  B B Bs 7A;;Brrr rc|j|}t|jdt||d<t|||S)z,See :meth:`telegram.TelegramObject.de_json`.rAr!)r"r r)r rr+)r,rrrs rr+zMenuButtonWebApp.de_jsonsAt$*488I+> CPYwDc22rr.) r/r0r1r2r3r4r rr rr5r+r7r8s@rr&r&sc<$I[_BSB:BhxFXB383(5/3EW33rr&c8eZdZdZdZdddeeffdZxZS)r(zDescribes that no specific value for the menu button was set. .. versionadded:: 20.0 Attributes: type (:obj:`str`): :tg-const:`telegram.constants.MenuButtonType.DEFAULT`. r:Nrrcxt|tjj||j yr<)rrrrr'rr=s rrzMenuButtonDefault.__init__s* i66>>:V rr>r8s@rr(r(s(I;?hx&8rr(N)r2typingrrrtelegramrtelegram._telegramobjectrtelegram._utilsrtelegram._utils.argumentparsingr telegram._utils.typesr telegram._webappinfor r rr$r&r(r:rrrNs]&E113 <*+I=I=X"03z03f  r