@@ -1022,6 +1022,10 @@ class Message(JsonDeserializable):
10221022 if it is a text message and link preview options were changed
10231023 :type link_preview_options: :class:`telebot.types.LinkPreviewOptions`
10241024
1025+ :param suggested_post_info: Optional. Information about suggested post parameters if the message is a suggested post
1026+ in a channel direct messages chat. If the message is an approved or declined suggested post, then it can't be edited.
1027+ :type suggested_post_info: :class:`telebot.types.SuggestedPostInfo`
1028+
10251029 :param effect_id: Optional. Unique identifier of the message effect added to the message
10261030 :type effect_id: :obj:`str`
10271031
@@ -1226,6 +1230,21 @@ class Message(JsonDeserializable):
12261230 :param paid_message_price_changed: Optional. Service message: the price for paid messages has changed in the chat
12271231 :type paid_message_price_changed: :class:`telebot.types.PaidMessagePriceChanged`
12281232
1233+ :param suggested_post_approved: Optional. Service message: a suggested post was approved
1234+ :type suggested_post_approved: :class:`telebot.types.SuggestedPostApproved
1235+
1236+ :param suggested_post_approval_failed: Optional. Service message: approval of a suggested post has failed
1237+ :type suggested_post_approval_failed: :class:`telebot.types.SuggestedPost
1238+
1239+ :param suggested_post_declined: Optional. Service message: a suggested post was declined
1240+ :type suggested_post_declined: :class:`telebot.types.SuggestedPostDecl
1241+
1242+ :param suggested_post_paid: Optional. Service message: payment for a suggested post was received
1243+ :type suggested_post_paid: :class:`telebot.types.SuggestedPostPaid`
1244+
1245+ :param suggested_post_refunded: Optional. Service message: payment for a suggested post was refunded
1246+ :type suggested_post_refunded: :class:`telebot.types.SuggestedPostRefunded`
1247+
12291248 :param video_chat_scheduled: Optional. Service message: video chat scheduled
12301249 :type video_chat_scheduled: :class:`telebot.types.VideoChatScheduled`
12311250
@@ -1510,6 +1529,24 @@ def de_json(cls, json_string):
15101529 opts['direct_messages_topic'] = DirectMessagesTopic.de_json(obj['direct_messages_topic'])
15111530 if 'is_paid_post' in obj:
15121531 opts['is_paid_post'] = obj['is_paid_post']
1532+ if 'suggested_post_info' in obj:
1533+ opts['suggested_post_info'] = SuggestedPostInfo.de_json(obj['suggested_post_info'])
1534+ content_type = 'suggested_post_info'
1535+ if 'suggested_post_approved' in obj:
1536+ opts['suggested_post_approved'] = SuggestedPostApproved.de_json(obj['suggested_post_approved'])
1537+ content_type = 'suggested_post_approved'
1538+ if 'suggested_post_approval_failed' in obj:
1539+ opts['suggested_post_approval_failed'] = SuggestedPostApprovalFailed.de_json(obj['suggested_post_approval_failed'])
1540+ content_type = 'suggested_post_approval_failed'
1541+ if 'suggested_post_declined' in obj:
1542+ opts['suggested_post_declined'] = SuggestedPostDeclined.de_json(obj['suggested_post_declined'])
1543+ content_type = 'suggested_post_declined'
1544+ if 'suggested_post_paid' in obj:
1545+ opts['suggested_post_paid'] = SuggestedPostPaid.de_json(obj['suggested_post_paid'])
1546+ content_type = 'suggested_post_paid'
1547+ if 'suggested_post_refunded' in obj:
1548+ opts['suggested_post_refunded'] = SuggestedPostRefunded.de_json(obj['suggested_post_refunded'])
1549+ content_type = 'suggested_post_refunded'
15131550
15141551 return cls(message_id, from_user, date, chat, content_type, opts, json_string)
15151552
@@ -1639,6 +1676,12 @@ def __init__(self, message_id, from_user, date, chat, content_type, options, jso
16391676 self.reply_to_checklist_task_id: Optional[int] = None
16401677 self.direct_messages_topic: Optional[DirectMessagesTopic] = None
16411678 self.is_paid_post: Optional[bool] = None
1679+ self.suggested_post_info: Optional[SuggestedPostInfo] = None
1680+ self.suggested_post_approved: Optional[SuggestedPostApproved] = None
1681+ self.suggested_post_approval_failed: Optional[SuggestedPostApprovalFailed] = None
1682+ self.suggested_post_declined: Optional[SuggestedPostDeclined] = None
1683+ self.suggested_post_paid: Optional[SuggestedPostPaid] = None
1684+ self.suggested_post_refunded: Optional[SuggestedPostRefunded] = None
16421685
16431686 for key in options:
16441687 setattr(self, key, options[key])
@@ -12942,7 +12985,7 @@ def de_json(cls, json_string):
1294212985 return cls(**obj)
1294312986
1294412987
12945- class SuggestedPostPrice(JsonSerializable):
12988+ class SuggestedPostPrice(JsonSerializable, JsonDeserializable ):
1294612989 """
1294712990 Describes the price of a suggested post.
1294812991
@@ -12969,7 +13012,13 @@ def to_dict(self):
1296913012 'currency': self.currency,
1297013013 'amount': self.amount
1297113014 }
12972- return data
13015+ return data
13016+
13017+ @classmethod
13018+ def de_json(cls, json_string):
13019+ if json_string is None: return None
13020+ obj = cls.check_json(json_string)
13021+ return cls(**obj)
1297313022
1297413023
1297513024class SuggestedPostParameters(JsonSerializable):
@@ -13002,3 +13051,187 @@ def to_dict(self):
1300213051 data['send_date'] = self.send_date
1300313052 return data
1300413053
13054+
13055+ class SuggestedPostInfo(JsonDeserializable):
13056+ """
13057+ Contains information about a suggested post.
13058+
13059+ Telegram documentation: https://core.telegram.org/bots/api#suggestedpostinfo
13060+
13061+ :param state: State of the suggested post. Currently, it can be one of “pending”, “approved”, “declined”.
13062+ :type state: :obj:`str`
13063+
13064+ :param price: Optional. Proposed price of the post. If the field is omitted, then the post is unpaid.
13065+ :type price: :class:`SuggestedPostPrice`
13066+
13067+ :param send_date: Optional. Proposed send date of the post. If the field is omitted, then the post can be published at any time within 30 days at the sole discretion of the user or administrator who approves it.
13068+ :type send_date: :obj:`int`
13069+
13070+ :return: Instance of the class
13071+ :rtype: :class:`SuggestedPostInfo`
13072+ """
13073+ def __init__(self, state: str, price: Optional[SuggestedPostPrice]
13074+ = None, send_date: Optional[int] = None, **kwargs):
13075+ self.state: str = state
13076+ self.price: Optional[SuggestedPostPrice] = price
13077+ self.send_date: Optional[int] = send_date
13078+
13079+ @classmethod
13080+ def de_json(cls, json_string):
13081+ if json_string is None: return None
13082+ obj = cls.check_json(json_string)
13083+ if 'price' in obj:
13084+ obj['price'] = SuggestedPostPrice.de_json(obj['price'])
13085+ return cls(**obj)
13086+
13087+
13088+ class SuggestedPostApproved(JsonDeserializable):
13089+ """
13090+ Describes a service message about the approval of a suggested post.
13091+
13092+ Telegram documentation: https://core.telegram.org/bots/api#suggestedpostapproved
13093+
13094+ :param suggested_post_message: Optional. Message containing the suggested post. Note that the Message object in this field will not contain the reply_to_message field even if it itself is a reply.
13095+ :type suggested_post_message: :class:`Message`
13096+
13097+ :param price: Optional. Amount paid for the post
13098+ :type price: :class:`SuggestedPostPrice`
13099+
13100+ :param send_date: Optional. Date when the post will be published
13101+ :type send_date: int
13102+
13103+ :return: Instance of the class
13104+ :rtype: :class:`SuggestedPostApproved`
13105+ """
13106+ def __init__(self, suggested_post_message: Optional[Message] = None,
13107+ price: Optional[SuggestedPostPrice] = None,
13108+ send_date: Optional[int] = None, **kwargs):
13109+ self.suggested_post_message: Optional[Message] = suggested_post_message
13110+ self.price: Optional[SuggestedPostPrice] = price
13111+ self.send_date: Optional[int] = send_date
13112+
13113+ @classmethod
13114+ def de_json(cls, json_string):
13115+ if json_string is None: return None
13116+ obj = cls.check_json(json_string)
13117+ if 'suggested_post_message' in obj:
13118+ obj['suggested_post_message'] = Message.de_json(obj['suggested_post_message'])
13119+ if 'price' in obj:
13120+ obj['price'] = SuggestedPostPrice.de_json(obj['price'])
13121+ return cls(**obj)
13122+
13123+ class SuggestedPostApprovalFailed(JsonDeserializable):
13124+ """
13125+ Describes a service message about the failed approval of a suggested post.
13126+ Currently, only caused by insufficient user funds at the time of approval.
13127+
13128+ Telegram documentation: https://core.telegram.org/bots/api#suggestedpostapprovalfailed
13129+
13130+ :param suggested_post_message: Optional. Message containing the suggested post whose approval has failed. Note that the Message object in this field will not contain the reply_to_message field even if it itself is a reply.
13131+ :type suggested_post_message: :class:`Message`
13132+
13133+ :return: Instance of the class
13134+ :rtype: :class:`SuggestedPostApprovalFailed`
13135+ """
13136+ def __init__(self, suggested_post_message: Optional[Message] = None, **kwargs):
13137+ self.suggested_post_message: Optional[Message] = suggested_post_message
13138+
13139+ @classmethod
13140+ def de_json(cls, json_string):
13141+ if json_string is None: return None
13142+ obj = cls.check_json(json_string)
13143+ if 'suggested_post_message' in obj:
13144+ obj['suggested_post_message'] = Message.de_json(obj['suggested_post_message'])
13145+ return cls(**obj)
13146+
13147+ class SuggestedPostDeclined(JsonDeserializable):
13148+ """
13149+ Describes a service message about the rejection of a suggested post.
13150+
13151+ Telegram documentation: https://core.telegram.org/bots/api#suggestedpostdeclined
13152+
13153+ :param suggested_post_message: Optional. Message containing the suggested post. Note that the Message object in this field will not contain the reply_to_message field even if it itself is a reply.
13154+ :type suggested_post_message: :class:`Message`
13155+
13156+ :return: Instance of the class
13157+ :rtype: :class:`SuggestedPostDeclined`
13158+ """
13159+ def __init__(self, suggested_post_message: Optional[Message] = None, comment: Optional[str] = None, **kwargs):
13160+ self.suggested_post_message: Optional[Message] = suggested_post_message
13161+ self.comment: Optional[str] = comment
13162+
13163+ @classmethod
13164+ def de_json(cls, json_string):
13165+ if json_string is None: return None
13166+ obj = cls.check_json(json_string)
13167+ if 'suggested_post_message' in obj:
13168+ obj['suggested_post_message'] = Message.de_json(obj['suggested_post_message'])
13169+ return cls(**obj)
13170+
13171+ class SuggestedPostPaid(JsonDeserializable):
13172+ """
13173+ Describes a service message about a successful payment for a suggested post.
13174+
13175+ Telegram documentation: https://core.telegram.org/bots/api#suggestedpostpaid
13176+
13177+ :param suggested_post_message: Optional. Message containing the suggested post. Note that the Message object in this field will not contain the reply_to_message field even if it itself is a reply.
13178+ :type suggested_post_message: :class:`Message`
13179+
13180+ :param currency: Currency in which the payment was made. Currently, one of “XTR” for Telegram Stars or “TON” for toncoins
13181+ :type currency: :obj:`str`
13182+
13183+ :param amount: Optional. The amount of the currency that was received by the channel in nanotoncoins; for payments in toncoins only
13184+ :type amount: :obj:`int`
13185+
13186+ :param star_amount: Optional. The amount of Telegram Stars that was received by the channel; for payments in Telegram Stars only
13187+ :type star_amount: :class:`StarAmount`
13188+
13189+ :return: Instance of the class
13190+ :rtype: :class:`SuggestedPostPaid`
13191+ """
13192+ def __init__(self, currency: str,suggested_post_message: Optional[Message] = None,
13193+ amount: Optional[int] = None,
13194+ star_amount: Optional[StarAmount] = None, **kwargs):
13195+ self.suggested_post_message: Optional[Message] = suggested_post_message
13196+ self.currency: str = currency
13197+ self.amount: Optional[int] = amount
13198+ self.star_amount: Optional[StarAmount] = star_amount
13199+ @classmethod
13200+ def de_json(cls, json_string):
13201+ if json_string is None: return None
13202+ obj = cls.check_json(json_string)
13203+ if 'suggested_post_message' in obj:
13204+ obj['suggested_post_message'] = Message.de_json(obj['suggested_post_message'])
13205+ if 'star_amount' in obj:
13206+ obj['star_amount'] = StarAmount.de_json(obj['star_amount'])
13207+ return cls(**obj)
13208+
13209+ class SuggestedPostRefunded(JsonDeserializable):
13210+ """
13211+ Describes a service message about a payment refund for a suggested post.
13212+
13213+ Telegram documentation: https://core.telegram.org/bots/api#suggestedpostrefunded
13214+
13215+ :param suggested_post_message: Optional. Message containing the suggested post. Note that the Message object in this field will not contain the reply_to_message field even if it itself is a reply.
13216+ :type suggested_post_message: :class:`Message`
13217+
13218+ :param reason: Reason for the refund. Currently, one of “post_deleted” if the post was deleted within 24 hours of being posted or removed from scheduled messages without being posted, or “payment_refunded” if the payer refunded their payment.
13219+ :type reason: :obj:`str`
13220+
13221+ :return: Instance of the class
13222+ :rtype: :class:`SuggestedPostRefunded`
13223+ """
13224+ def __init__(self, suggested_post_message: Optional[Message] = None, reason: Optional[str] = None, **kwargs):
13225+ self.suggested_post_message: Optional[Message] = suggested_post_message
13226+ self.reason: Optional[str] = reason
13227+
13228+ @classmethod
13229+ def de_json(cls, json_string):
13230+ if json_string is None: return None
13231+ obj = cls.check_json(json_string)
13232+ if 'suggested_post_message' in obj:
13233+ obj['suggested_post_message'] = Message.de_json(obj['suggested_post_message'])
13234+ return cls(**obj)
13235+
13236+
13237+
0 commit comments