L ih[HdZddlZddlmZmZmZddlmZddl m Z ddl m Z ddl mZddlmZdd lmZdd lmZmZdd lmZerdd lmZGd deZGddeZGddeZGddeZGddeZGddeZGddeZGddeZ y)zAThis module contains objects related to Telegram suggested posts.N) TYPE_CHECKINGFinalOptional) constants)Message) StarAmount)TelegramObject)enum)de_json_optional)extract_tzinfo_from_defaultsfrom_timestamp)JSONDict)Botc@eZdZdZdZdddededeeffdZ xZ S) SuggestedPostPriceuI Desribes the price of a suggested post. Objects of this class are comparable in terms of equality. Two objects of this class are considered equal, if their :attr:`currency` and :attr:`amount` are equal. .. versionadded:: 22.4 Args: currency (:obj:`str`): Currency in which the post will be paid. Currently, must be one of ``“XTR”`` for Telegram Stars or ``“TON”`` for toncoins. amount (:obj:`int`): The amount of the currency that will be paid for the post in the smallest units of the currency, i.e. Telegram Stars or nanotoncoins. Currently, price in Telegram Stars must be between :tg-const:`telegram.constants.SuggestedPost.MIN_PRICE_STARS` and :tg-const:`telegram.constants.SuggestedPost.MAX_PRICE_STARS`, and price in nanotoncoins must be between :tg-const:`telegram.constants.SuggestedPost.MIN_PRICE_NANOTONCOINS` and :tg-const:`telegram.constants.SuggestedPost.MAX_PRICE_NANOTONCOINS`. Attributes: currency (:obj:`str`): Currency in which the post will be paid. Currently, must be one of ``“XTR”`` for Telegram Stars or ``“TON”`` for toncoins. amount (:obj:`int`): The amount of the currency that will be paid for the post in the smallest units of the currency, i.e. Telegram Stars or nanotoncoins. Currently, price in Telegram Stars must be between :tg-const:`telegram.constants.SuggestedPost.MIN_PRICE_STARS` and :tg-const:`telegram.constants.SuggestedPost.MAX_PRICE_STARS`, and price in nanotoncoins must be between :tg-const:`telegram.constants.SuggestedPost.MIN_PRICE_NANOTONCOINS` and :tg-const:`telegram.constants.SuggestedPost.MAX_PRICE_NANOTONCOINS`. )amountcurrencyN api_kwargsrrrct||||_||_|j|jf|_|j yNr)super__init__rr _id_attrs_freeze)selfrrr __class__s ]/mnt/ssd/data/python-lab/Trading/venv/lib/python3.12/site-packages/telegram/_suggestedpost.pyrzSuggestedPostPrice.__init__Ks@ J/% ! --5 ) __name__ __module__ __qualname____doc__ __slots__strintrrr __classcell__rs@rrr%s@!F'I*.    X&  rrc eZdZdZdZ ddddeedeejdee ffdZ e dd e d ed d dffd Z xZ S)SuggestedPostParametersa2 Contains parameters of a post that is being suggested by the bot. Objects of this class are comparable in terms of equality. Two objects of this class are considered equal, if their :attr:`price` and :attr:`send_date` are equal. .. versionadded:: 22.4 Args: price (:class:`telegram.SuggestedPostPrice`, optional): Proposed price for the post. If the field is omitted, then the post is unpaid. send_date (:class:`datetime.datetime`, optional): Proposed send date of the post. If specified, then the date must be between :tg-const:`telegram.constants.SuggestedPost.MIN_SEND_DATE` second and :tg-const:`telegram.constants.SuggestedPost.MAX_SEND_DATE` seconds (30 days) in the future. If the field is omitted, then the post can be published at any time within :tg-const:`telegram.constants.SuggestedPost.MAX_SEND_DATE` seconds (30 days) at the sole discretion of the user who approves it. |datetime_localization| Attributes: price (:class:`telegram.SuggestedPostPrice`): Optional. Proposed price for the post. If the field is omitted, then the post is unpaid. send_date (:class:`datetime.datetime`): Optional. Proposed send date of the post. If specified, then the date must be between :tg-const:`telegram.constants.SuggestedPost.MIN_SEND_DATE` second and :tg-const:`telegram.constants.SuggestedPost.MAX_SEND_DATE` seconds (30 days) in the future. If the field is omitted, then the post can be published at any time within :tg-const:`telegram.constants.SuggestedPost.MAX_SEND_DATE` seconds (30 days) at the sole discretion of the user who approves it. |datetime_localization| )price send_dateNrr+r,rct||||_||_|j|jf|_|j yr)rrr+r,rr)rr+r,rrs rrz SuggestedPostParameters.__init__s@ J/38 1:**dnn5 rdatabotrreturnc|j|}t|jdt||d<t |}t |jd||d<t |||S,See :meth:`telegram.TelegramObject.de_json`.r+r,tzinfor.r/) _parse_datar getrr r rde_jsonclsr.r/ loc_tzinfors rr9zSuggestedPostParameters.de_jsonsit$('):)r r!r"r#r$rrJrErr%__annotations__rFrGrrr?r@rrrAr9r'r(s@rrCrCs$L0I#::BBGU3ZBD$;;DDHeCjDE$;;DDHeCjDE /3,0  *. *+CLL)  X& & 38 3(5/ 3EX 3 3rrCc |eZdZdZdZ ddddeedeedeeffdZ e dd ed ed d dffd Z xZ S)SuggestedPostDeclinedad Describes a service message about the rejection of a suggested post. Objects of this class are comparable in terms of equality. Two objects of this class are considered equal, if their :attr:`suggested_post_message` and :attr:`comment` are equal. .. versionadded:: 22.4 Args: suggested_post_message (:class:`telegram.Message`, optional): Message containing the suggested post. Note that the :class:`~telegram.Message` object in this field will not contain the :attr:`~telegram.Message.reply_to_message` field even if it itself is a reply. comment (:obj:`str`, optional): Comment with which the post was declined. Attributes: suggested_post_message (:class:`telegram.Message`): Optional. Message containing the suggested post. Note that the :class:`~telegram.Message` object in this field will not contain the :attr:`~telegram.Message.reply_to_message` field even if it itself is a reply. comment (:obj:`str`): Optional. Comment with which the post was declined. )commentsuggested_post_messageNrrPrOrct||||_||_|j|jf|_|j yr)rrrPrOrr)rrPrOrrs rrzSuggestedPostDeclined.__init__ sC J/9O#&- 55t||D rr.r/rr0c|j|}t|jdt||d<t|||Sr3rPr6r7r r8rrr9r;r.r/rs rr9zSuggestedPostDeclined.de_jsonIt$)9 HH- .*  %&wDc22rr=r>) r r!r"r#r$rrr%rrrAr9r'r(s@rrNrNs~46I59!%  *.  ( 1 #  X& 383(5/3E\33rrNc eZdZdZdZ ddddedeedeedee d ee f fd Z e dd e d ed ddffd Z xZS)SuggestedPostPaidu Describes a service message about a successful payment for a suggested post. Objects of this class are comparable in terms of equality. Two objects of this class are considered equal, if all of their attributes are equal. .. versionadded:: 22.4 Args: suggested_post_message (:class:`telegram.Message`, optional): Message containing the suggested post. Note that the :class:`~telegram.Message` object in this field will not contain the :attr:`~telegram.Message.reply_to_message` field even if it itself is a reply. currency (:obj:`str`): Currency in which the payment was made. Currently, one of ``“XTR”`` for Telegram Stars or ``“TON”`` for toncoins. amount (:obj:`int`, optional): The amount of the currency that was received by the channel in nanotoncoins; for payments in toncoins only. star_amount (:class:`telegram.StarAmount`, optional): The amount of Telegram Stars that was received by the channel; for payments in Telegram Stars only. Attributes: suggested_post_message (:class:`telegram.Message`): Optional. Message containing the suggested post. Note that the :class:`~telegram.Message` object in this field will not contain the :attr:`~telegram.Message.reply_to_message` field even if it itself is a reply. currency (:obj:`str`): Currency in which the payment was made. Currently, one of ``“XTR”`` for Telegram Stars or ``“TON”`` for toncoins. amount (:obj:`int`): Optional. The amount of the currency that was received by the channel in nanotoncoins; for payments in toncoins only. star_amount (:class:`telegram.StarAmount`): Optional. The amount of Telegram Stars that was received by the channel; for payments in Telegram Stars only. )rr star_amountrPNrrrPrrYrct||||_||_||_||_|j|j|j|j f|_|jyr)rrrrPrrYrr)rrrPrrYrrs rrzSuggestedPostPaid.__init__Tsi J/% 9O#%+ 1< MM  ' ' KK      rr.r/rr0c|j|}t|jdt||d<t|jdt||d<t |||S)r3rPrYr6)r7r r8rrrr9rUs rr9zSuggestedPostPaid.de_jsonnsft$)9 HH- .*  %&/txx /F TWX]wDc22r)NNNr>)r r!r"r#r$r%rrr&rrrrAr9r'r(s@rrXrX(s'RPI 59 $,0 *.!) 1  j) X&4 38 3(5/ 3EX 3 3rrXc teZdZdZdZ ddddedeedeeffdZ e dd ed ed d dffd Z xZ S)SuggestedPostRefundeda Describes a service message about a payment refund for a suggested post. Objects of this class are comparable in terms of equality. Two objects of this class are considered equal, if their :attr:`suggested_post_message` and :attr:`reason` are equal. .. versionadded:: 22.4 Args: suggested_post_message (:class:`telegram.Message`, optional): Message containing the suggested post. Note that the :class:`~telegram.Message` object in this field will not contain the :attr:`~telegram.Message.reply_to_message` field even if it itself is a reply. reason (:obj:`str`): Reason for the refund. Currently, one of :tg-const:`telegram.constants.SuggestedPostRefunded.POST_DELETED` if the post was deleted within 24 hours of being posted or removed from scheduled messages without being posted, or :tg-const:`telegram.constants.SuggestedPostRefunded.PAYMENT_REFUNDED` if the payer refunded their payment. Attributes: suggested_post_message (:class:`telegram.Message`): Optional. Message containing the suggested post. Note that the :class:`~telegram.Message` object in this field will not contain the :attr:`~telegram.Message.reply_to_message` field even if it itself is a reply. reason (:obj:`str`): Reason for the refund. Currently, one of :tg-const:`telegram.constants.SuggestedPostRefunded.POST_DELETED` if the post was deleted within 24 hours of being posted or removed from scheduled messages without being posted, or :tg-const:`telegram.constants.SuggestedPostRefunded.PAYMENT_REFUNDED` if the payer refunded their payment. )reasonrPNrr^rPrct||||_||_|j|jf|_|j yr)rrr^rPrr)rr^rPrrs rrzSuggestedPostRefunded.__init__sC J/! 9O#++t'B'BC rr.r/rr0c|j|}t|jdt||d<t|||SrSrTrUs rr9zSuggestedPostRefunded.de_jsonrVrr>) r r!r"r#r$r%rrrrrAr9r'r(s@rr]r]{sx D5I 59 *. !) 1 X& "383(5/3E\33rr]c eZdZdZdZ ddddej deedee dee ffd Z e dd e d ed d dffd Z xZS)SuggestedPostApprovedaH Describes a service message about the approval of a suggested post. Objects of this class are comparable in terms of equality. Two objects of this class are considered equal, if all of their attributes are equal. .. versionadded:: 22.4 Args: suggested_post_message (:class:`telegram.Message`, optional): Message containing the suggested post. Note that the :class:`~telegram.Message` object in this field will not contain the :attr:`~telegram.Message.reply_to_message` field even if it itself is a reply. price (:obj:`SuggestedPostPrice`, optional): Amount paid for the post. send_date (:class:`datetime.datetime`): Date when the post will be published. |datetime_localization| Attributes: suggested_post_message (:class:`telegram.Message`): Optional. Message containing the suggested post. Note that the :class:`~telegram.Message` object in this field will not contain the :attr:`~telegram.Message.reply_to_message` field even if it itself is a reply. price (:obj:`SuggestedPostPrice`): Optional. Amount paid for the post. send_date (:class:`datetime.datetime`): Date when the post will be published. |datetime_localization| )r+r,rPNrr,rPr+rct||||_||_||_|j|j|jf|_|j yr)rrr,rPr+rr)rr,rPr+rrs rrzSuggestedPostApproved.__init__sP J/'09O#38 ..$*E*EtzzR rr.r/rr0c(|j|}t|}t|jd||d<t |jdt ||d<t |jdt ||d<t|!||S)r3r,r4r+rPr6) r7r r r8r rrrr9r:s rr9zSuggestedPostApproved.de_jsonst$2#6 *488K+@T[('):)r r!r"r#r$r?r@rrrrrrAr9r'r(s@rrbrbs@AI 59.2  *. <<!) 1*+  X& & 38 3(5/ 3E\ 3 3rrbc teZdZdZdZ ddddedeedeeffdZ e dd ed ed d dffd Z xZ S)SuggestedPostApprovalFaileda Describes a service message about the failed approval of a suggested post. Currently, only caused by insufficient user funds at the time of approval. Objects of this class are comparable in terms of equality. Two objects of this class are considered equal, if their :attr:`suggested_post_message` and :attr:`price` are equal. .. versionadded:: 22.4 Args: suggested_post_message (:class:`telegram.Message`, optional): Message containing the suggested post. Note that the :class:`~telegram.Message` object in this field will not contain the :attr:`~telegram.Message.reply_to_message` field even if it itself is a reply. price (:obj:`SuggestedPostPrice`): Expected price of the post. Attributes: suggested_post_message (:class:`telegram.Message`): Optional. Message containing the suggested post. Note that the :class:`~telegram.Message` object in this field will not contain the :attr:`~telegram.Message.reply_to_message` field even if it itself is a reply. price (:obj:`SuggestedPostPrice`): Expected price of the post. )r+rPNrr+rPrct||||_||_|j|jf|_|j yr)rrr+rPrr)rr+rPrrs rrz$SuggestedPostApprovalFailed.__init__"sC J/). 9O#**d&A&AB rr.r/rr0c|j|}t|jdt||d<t|jdt||d<t |||S)r3r+rPr6)r7r r8rrrr9rUs rr9z#SuggestedPostApprovalFailed.de_json3sft$('):) r r!r"r#r$rrrrrrAr9r'r(s@rrfrfsw64I 59 *. !!) 1 X& " 38 3(5/ 3Eb 3 3rrf)!r#r@r?typingrrrtelegramrtelegram._messager"telegram._payment.stars.staramountrtelegram._telegramobjectr telegram._utilsr telegram._utils.argumentparsingr telegram._utils.datetimer r telegram._utils.typesrrrr*rCrNrXr]rbrfrrrss&H11%93 <Q*33lA3nA3HN3N3b53N53pP3P3f?3N?3DD3ND3N93.93r