From af6f485ba6e3a50d7770562c74746ec2f83cf305 Mon Sep 17 00:00:00 2001 From: _run Date: Sat, 30 Dec 2023 13:19:02 +0500 Subject: [PATCH] Added the class MessageOrigin and replaced the fields forward_from, forward_from_chat, forward_from_message_id, forward_signature, forward_sender_name, and forward_date with the field forward_origin of type MessageOrigin in the class Message. --- telebot/types.py | 8 ++++++-- 1 file changed, 6 insertions(+), 2 deletions(-) diff --git a/telebot/types.py b/telebot/types.py index 66a0e19f4..63b69b14a 100644 --- a/telebot/types.py +++ b/telebot/types.py @@ -833,6 +833,9 @@ class Message(JsonDeserializable): :param forward_date: Optional. For forwarded messages, date the original message was sent in Unix time :type forward_date: :obj:`int` + :forward_origin: Optional. For forwarded messages, information about the original message; + :type forward_origin: :class:`telebot.types.MessageOrigin` + :param is_topic_message: Optional. True, if the message is sent to a forum topic :type is_topic_message: :obj:`bool` @@ -1289,8 +1292,8 @@ def de_json(cls, json_string): if 'giveaway_completed' in obj: opts['giveaway_completed'] = GiveawayCompleted.de_json(obj['giveaway_completed']) content_type = 'giveaway_completed' - - + if 'message_origin' in obj: + opts['message_origin'] = MessageOrigin.de_json(obj['message_origin']) return cls(message_id, from_user, date, chat, content_type, opts, json_string) @@ -1398,6 +1401,7 @@ def __init__(self, message_id, from_user, date, chat, content_type, options, jso self.giveaway: Optional[Giveaway] = None self.giveaway_winners: Optional[GiveawayWinners] = None self.giveaway_completed: Optional[GiveawayCompleted] = None + self.forward_origin: Optional[MessageOrigin] = None for key in options: