L iJ,dZddlZddlmZddlmZmZmZddl m Z ddl m Z ddl mZddlmZdd lmZdd lmZdd lmZdd lmZmZmZdd lmZmZddlmZm Z ddl!m"Z"erddl m#Z#GddeZ$GddeZ%Gdde$Z&Gdde$Z'y)z8This module contains objects that represent owned gifts.N)Sequence) TYPE_CHECKINGFinalOptional) constants)Gift) MessageEntity)TelegramObject) UniqueGift)User)enum)de_json_optionalde_list_optionalparse_sequence_arg)extract_tzinfo_from_defaultsfrom_timestamp)parse_message_entitiesparse_message_entity)JSONDict)BotceZdZUdZdZej jZee e d< ej jZ ee e d< ddde de e d dffd Zedd e d e d d dffd ZxZS) OwnedGiftaThis object describes a gift received and owned by a user or a chat. Currently, it can be one of: * :class:`telegram.OwnedGiftRegular` * :class:`telegram.OwnedGiftUnique` Objects of this class are comparable in terms of equality. Two objects of this class are considered equal, if their :attr:`type` is equal. .. versionadded:: 22.1 Args: type (:obj:`str`): Type of the owned gift. Attributes: type (:obj:`str`): Type of the owned gift. )typeREGULARUNIQUEN api_kwargsrrreturnct||tjtj |||_|j f|_|jyNr) super__init__r get_memberr OwnedGiftTyper _id_attrs_freeze)selfrr __class__s Y/mnt/ssd/data/python-lab/Trading/venv/lib/python3.12/site-packages/telegram/_ownedgift.pyr"zOwnedGift.__init__CsE J/)@)@$M )) databotrc |j|}|jt|jti}|t ur8|j d|vr%||jdj||St|!||S)aXConverts JSON data to the appropriate :class:`OwnedGift` 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. Returns: The Telegram object. rr+r,) _parse_datarOwnedGiftRegularrOwnedGiftUniquergetpopde_jsonr!)clsr+r,_class_mappingr(s r)r4zOwnedGift.de_jsonOst$ KK) JJ6  )  0N B!$((6"23;;3;O OwDc22r*N)__name__ __module__ __qualname____doc__ __slots__rr$rrstr__annotations__rrrr" classmethodr4 __classcell__r(s@r)rr)s$I#1199GU3Z9;"0077FE#J7: *.  X&   383(5/3[33r*rc ~eZdZdZdZ ddddedeedee dee ffd Z e dd e d ed d dffd Z xZS) OwnedGiftsauContains the list of gifts received and owned by a user or a chat. Objects of this class are comparable in terms of equality. Two objects of this class are considered equal, if their :attr:`total_count` and :attr:`gifts` are equal. .. versionadded:: 22.1 Args: total_count (:obj:`int`): The total number of gifts owned by the user or the chat. gifts (Sequence[:class:`telegram.OwnedGift`]): The list of gifts. next_offset (:obj:`str`, optional): Offset for the next request. If empty, then there are no more results. Attributes: total_count (:obj:`int`): The total number of gifts owned by the user or the chat. gifts (Sequence[:class:`telegram.OwnedGift`]): The list of gifts. next_offset (:obj:`str`): Optional. Offset for the next request. If empty, then there are no more results. )gifts next_offset total_countNrrFrDrErct||||_t||_||_|j|jf|_|jyr )r!r"rFrrDrEr%r&)r'rFrDrErr(s r)r"zOwnedGifts.__init__sP J/ +,>u,E *5**DJJ7 r*r+r,rrc|j|}t|jdt||d<t|||S)z,See :meth:`telegram.TelegramObject.de_json`.rDr.)r/rr2rr!r4)r5r+r,r(s r)r4zOwnedGifts.de_jsonsAt$('):IsKW wDc22r*r7)r8r9r:r;r<intrrrr=rr"r?r4r@rAs@r)rCrCis(I&*  *.  "c]  X& "383(5/3\33r*rCc:eZdZdZdZ ddddedejdee dee d ee d ee e d ee d ee d ee dee deedeedeeddffdZeddededddffd Zde de fdZddeee dee e ffdZxZS)r0aDescribes a regular gift owned by a user or a chat. Objects of this class are comparable in terms of equality. Two objects of this class are considered equal, if their :attr:`gift` and :attr:`send_date` are equal. .. versionadded:: 22.1 Args: gift (:class:`telegram.Gift`): Information about the regular gift. owned_gift_id (:obj:`str`, optional): Unique identifier of the gift for the bot; for gifts received on behalf of business accounts only. sender_user (:class:`telegram.User`, optional): Sender of the gift if it is a known user. send_date (:obj:`datetime.datetime`): Date the gift was sent as :class:`datetime.datetime`. |datetime_localization|. text (:obj:`str`, optional): Text of the message that was added to the gift. entities (Sequence[:class:`telegram.MessageEntity`], optional): Special entities that appear in the text. is_private (:obj:`bool`, optional): :obj:`True`, if the sender and gift text are shown only to the gift receiver; otherwise, everyone will be able to see them. is_saved (:obj:`bool`, optional): :obj:`True`, if the gift is displayed on the account's profile page; for gifts received on behalf of business accounts only. can_be_upgraded (:obj:`bool`, optional): :obj:`True`, if the gift can be upgraded to a unique gift; for gifts received on behalf of business accounts only. was_refunded (:obj:`bool`, optional): :obj:`True`, if the gift was refunded and isn't available anymore. convert_star_count (:obj:`int`, optional): Number of Telegram Stars that can be claimed by the receiver instead of the gift; omitted if the gift cannot be converted to Telegram Stars. prepaid_upgrade_star_count (:obj:`int`, optional): Number of Telegram Stars that were paid by the sender for the ability to upgrade the gift. Attributes: type (:obj:`str`): Type of the gift, always :attr:`~telegram.OwnedGift.REGULAR`. gift (:class:`telegram.Gift`): Information about the regular gift. owned_gift_id (:obj:`str`): Optional. Unique identifier of the gift for the bot; for gifts received on behalf of business accounts only. sender_user (:class:`telegram.User`): Optional. Sender of the gift if it is a known user. send_date (:obj:`datetime.datetime`): Date the gift was sent as :class:`datetime.datetime`. |datetime_localization|. text (:obj:`str`): Optional. Text of the message that was added to the gift. entities (Sequence[:class:`telegram.MessageEntity`]): Optional. Special entities that appear in the text. is_private (:obj:`bool`): Optional. :obj:`True`, if the sender and gift text are shown only to the gift receiver; otherwise, everyone will be able to see them. is_saved (:obj:`bool`): Optional. :obj:`True`, if the gift is displayed on the account's profile page; for gifts received on behalf of business accounts only. can_be_upgraded (:obj:`bool`): Optional. :obj:`True`, if the gift can be upgraded to a unique gift; for gifts received on behalf of business accounts only. was_refunded (:obj:`bool`): Optional. :obj:`True`, if the gift was refunded and isn't available anymore. convert_star_count (:obj:`int`): Optional. Number of Telegram Stars that can be claimed by the receiver instead of the gift; omitted if the gift cannot be converted to Telegram Stars. prepaid_upgrade_star_count (:obj:`int`): Optional. Number of Telegram Stars that were paid by the sender for the ability to upgrade the gift. ) can_be_upgradedconvert_star_countentitiesgift is_privateis_saved owned_gift_idprepaid_upgrade_star_count send_date sender_usertext was_refundedNrrNrSrQrTrUrMrOrPrKrVrLrRrrc t|tj| |j 5||_||_||_||_||_ t||_ ||_ ||_ | |_| |_| |_| |_|j$|j |j f|_dddy#1swYyxYwN)rr)r!r"rr _unfrozenrNrSrQrTrUrrMrOrPrKrVrLrRrr%)r'rNrSrQrTrUrMrOrPrKrVrLrRrr(s r)r"zOwnedGiftRegular.__init__s" i//JG ^^  D"DI+4DN0=D /:D '+DI7I(7SDM.8DO,4DM3BD 0PD #"iiDNNCDN D D Ds A!BB$r+r,rcf|j|}t|}t|jd||d<t |jdt ||d<t |jdt ||d<t|jd||d<t|!||S)r[rSr\rTrNror.) r/rrr2rr r r!r4r^s r)r4zOwnedGiftUnique.de_jsonst$1#6 *488K+@T[.txx /FcR]'(8*cJV %3 HH) *:&  !"wDc22r*)NNNNNNr7)r8r9r:r;r<r rhrirr=r rjrIrr"r?r4r@rAs@r)r1r1Os,\ I(,&*#'-1-159D*.DD<<D } D d^ D 4. D%TND&c]D%S\\2DX&D D6 38 3(5/ 3EV 3 3r*r1)(r;rirhcollections.abcrtypingrrrtelegramrtelegram._giftsrtelegram._messageentityr telegram._telegramobjectr telegram._uniquegiftr telegram._userr telegram._utilsr telegram._utils.argumentparsingrrrtelegram._utils.datetimerrtelegram._utils.entitiesrrtelegram._utils.typesrrrrCr0r1r*r)rsy&?$11 13+ bbQQ*=3=3@2323jnGynGbb3ib3r*