L i-dZddlmZddlmZmZddlmZddlm Z ddl m Z m Z ddl mZddlmZmZmZerdd lmZGd d e ZGd d e ZGdde Zy)zOThis module contains two objects used for request chats/users service messages.)Sequence) TYPE_CHECKINGOptional) PhotoSize)TelegramObject)de_list_optionalparse_sequence_arg)JSONDict) get_full_nameget_linkget_name)BotcpeZdZdZdZdddededdeeffd Z e dd ed ed d dffd Z xZ S) UsersShareda  This object contains information about the user whose identifier was shared with the bot using a :class:`telegram.KeyboardButtonRequestUsers` button. Objects of this class are comparable in terms of equality. Two objects of this class are considered equal, if their :attr:`request_id` and :attr:`users` are equal. .. versionadded:: 20.8 Bot API 7.0 replaces ``UserShared`` with this class. The only difference is that now the ``user_ids`` is a sequence instead of a single integer. .. versionchanged:: 21.1 The argument :attr:`users` is now considered for the equality comparison instead of ``user_ids``. .. versionremoved:: 21.2 Removed the deprecated argument and attribute ``user_ids``. Args: request_id (:obj:`int`): Identifier of the request. users (Sequence[:class:`telegram.SharedUser`]): Information about users shared with the bot. .. versionadded:: 21.1 .. versionchanged:: 21.2 This argument is now required. Attributes: request_id (:obj:`int`): Identifier of the request. users (tuple[:class:`telegram.SharedUser`]): Information about users shared with the bot. .. versionadded:: 21.1 ) request_idusersN api_kwargsrr SharedUserrct||||_t||_|j|jf|_|j yNr)super__init__rr r _id_attrs_freeze)selfrrr __class__s V/mnt/ssd/data/python-lab/Trading/venv/lib/python3.12/site-packages/telegram/_shared.pyrzUsersShared.__init__IsE J/)-?-F //4::6 databotrreturnc|j|}t|jdt||d<i}|jdx}rd|i}t||||S),See :meth:`telegram.TelegramObject.de_json`.ruser_ids)r r!r) _parse_datargetrr_de_json)clsr r!rr%rs rde_jsonzUsersShared.de_jsonXsjt$('):JLW  xx + +8 +$h/JwTszJJrN) __name__ __module__ __qualname____doc__ __slots__intrrr r classmethodr* __classcell__rs@rrr"sr"H(I*.   %  X&  K8 K(5/ K] K KrrceZdZdZdZ ddddededeedeed eee d ee f fd Z e dd e d edddffd Z edeefdZxZS) ChatShareda This object contains information about the chat whose identifier was shared with the bot using a :class:`telegram.KeyboardButtonRequestChat` button. Objects of this class are comparable in terms of equality. Two objects of this class are considered equal, if their :attr:`request_id` and :attr:`chat_id` are equal. .. versionadded:: 20.1 Args: request_id (:obj:`int`): Identifier of the request. chat_id (:obj:`int`): Identifier of the shared user. This number may be greater than 32 bits and some programming languages may have difficulty/silent defects in interpreting it. But it is smaller than 52 bits, so a signed 64-bit integer or double-precision float type are safe for storing this identifier. title (:obj:`str`, optional): Title of the chat, if the title was requested by the bot. .. versionadded:: 21.1 username (:obj:`str`, optional): Username of the chat, if the username was requested by the bot and available. .. versionadded:: 21.1 photo (Sequence[:class:`telegram.PhotoSize`], optional): Available sizes of the chat photo, if the photo was requested by the bot .. versionadded:: 21.1 Attributes: request_id (:obj:`int`): Identifier of the request. chat_id (:obj:`int`): Identifier of the shared user. This number may be greater than 32 bits and some programming languages may have difficulty/silent defects in interpreting it. But it is smaller than 52 bits, so a signed 64-bit integer or double-precision float type are safe for storing this identifier. title (:obj:`str`): Optional. Title of the chat, if the title was requested by the bot. .. versionadded:: 21.1 username (:obj:`str`): Optional. Username of the chat, if the username was requested by the bot and available. .. versionadded:: 21.1 photo (tuple[:class:`telegram.PhotoSize`]): Optional. Available sizes of the chat photo, if the photo was requested by the bot .. versionadded:: 21.1 )chat_idphotortitleusernameNrrr7r9r:r8rct||||_||_||_||_t ||_|j|jf|_|jyr) rrrr7r9r:r r8rr)rrr7r9r:r8rrs rrzChatShared.__init__sZ J/)# $) '/ 6H6O //4<<8 rr r!rr"c|j|}t|jdt||d<t|||Sr$r8)r r!r&rr'rrr*r)r r!rs rr*zChatShared.de_jsonAt$('):IsKW wDc22rct|S)z:obj:`str`: Convenience property. If :attr:`username` is available, returns a t.me link of the chat. .. versionadded:: 22.4 r rs rlinkzChatShared.link~r)NNNr+)r,r-r.r/r0r1rstrrrr rr2r*propertyrDr3r4s@rr6r6hs,\HI $"&/3 *.}  3-  +, X&*383(5/3\33hsmrr6ceZdZdZdZ ddddedeedeedeed eee d ee f fd Z e d eefd Z e d eefdZe d eefdZedde dedd dffd ZxZS)ra This object contains information about a user that was shared with the bot using a :class:`telegram.KeyboardButtonRequestUsers` button. Objects of this class are comparable in terms of equality. Two objects of this class are considered equal, if their :attr:`user_id` is equal. .. versionadded:: 21.1 Args: user_id (:obj:`int`): Identifier of the shared user. This number may have 32 significant bits and some programming languages may have difficulty/silent defects in interpreting it. But it has atmost 52 significant bits, so 64-bit integers or double-precision float types are safe for storing these identifiers. The bot may not have access to the user and could be unable to use this identifier, unless the user is already known to the bot by some other means. first_name (:obj:`str`, optional): First name of the user, if the name was requested by the bot. last_name (:obj:`str`, optional): Last name of the user, if the name was requested by the bot. username (:obj:`str`, optional): Username of the user, if the username was requested by the bot. photo (Sequence[:class:`telegram.PhotoSize`], optional): Available sizes of the chat photo, if the photo was requested by the bot. Attributes: user_id (:obj:`int`): Identifier of the shared user. This number may have 32 significant bits and some programming languages may have difficulty/silent defects in interpreting it. But it has atmost 52 significant bits, so 64-bit integers or double-precision float types are safe for storing these identifiers. The bot may not have access to the user and could be unable to use this identifier, unless the user is already known to the bot by some other means. first_name (:obj:`str`): Optional. First name of the user, if the name was requested by the bot. last_name (:obj:`str`): Optional. Last name of the user, if the name was requested by the bot. username (:obj:`str`): Optional. Username of the user, if the username was requested by the bot. photo (tuple[:class:`telegram.PhotoSize`]): Available sizes of the chat photo, if the photo was requested by the bot. This list is empty if the photo was not requsted. ) first_name last_namer8user_idr:NrrKrIrJr:r8rct||||_||_||_||_t ||_|jf|_|jyr) rrrKrIrJr:r r8rr)rrKrIrJr:r8rrs rrzSharedUser.__init__sS J/# )3(1'/ 6H6O ,, rr"ct|S)z:obj:`str`: Convenience property. If available, returns the user's :attr:`username` prefixed with "@". If :attr:`username` is not available, returns :attr:`full_name`. .. versionadded:: 22.4 )r rCs rnamezSharedUser.namerErct|S)z:obj:`str`: Convenience property. If :attr:`first_name` is not :obj:`None`, gives :attr:`first_name` followed by (if available) :attr:`last_name`. .. versionadded:: 22.4 )r rCs r full_namezSharedUser.full_name sT""rct|S)z:obj:`str`: Convenience property. If :attr:`username` is available, returns a t.me link of the user. .. versionadded:: 22.4 rBrCs rrDzSharedUser.linkrErr r!rc|j|}t|jdt||d<t|||Sr=r>r?s rr*zSharedUser.de_jsonr@r)NNNNr+)r,r-r.r/r0r1rrFrrr rrGrNrPrDr2r*r3r4s@rrrs (TLI %)#'"&/3 *.SMC=  3-  +, X&*hsm#8C=##hsm383(5/3\33rrN)r/collections.abcrtypingrrtelegram._files.photosizertelegram._telegramobjectrtelegram._utils.argumentparsingrr telegram._utils.typesr telegram._utils.usernamesr r r telegram._botrrr6rrrr\sW&V$*/3P*GG!CK.CKLUUpc3c3r