From a26117416b3cd8a40ae92c7ad8fbfd5e4dde781e Mon Sep 17 00:00:00 2001 From: _run Date: Fri, 29 Dec 2023 23:39:35 +0500 Subject: [PATCH] Added the field link_preview_options to the class Message with information about the link preview options used to send the message. --- telebot/types.py | 9 +++++++++ 1 file changed, 9 insertions(+) diff --git a/telebot/types.py b/telebot/types.py index c76b8d049..26cd50dca 100644 --- a/telebot/types.py +++ b/telebot/types.py @@ -836,6 +836,10 @@ class Message(JsonDeserializable): appear in the text :type entities: :obj:`list` of :class:`telebot.types.MessageEntity` + :param link_preview_options: Optional. Options used for link preview generation for the message, + if it is a text message and link preview options were changed + :type link_preview_options: :class:`telebot.types.LinkPreviewOptions` + :param animation: Optional. Message is an animation, information about the animation. For backward compatibility, when this field is set, the document field will also be set :type animation: :class:`telebot.types.Animation` @@ -1221,6 +1225,10 @@ def de_json(cls, json_string): opts['quote'] = TextQuote.de_json(obj['quote']) content_type = 'text' # Here too, check the content types + if 'link_preview_options' in obj: + opts['link_preview_options'] = LinkPreviewOptions.de_json(obj['link_preview_options']) + + return cls(message_id, from_user, date, chat, content_type, opts, json_string) @classmethod @@ -1321,6 +1329,7 @@ def __init__(self, message_id, from_user, date, chat, content_type, options, jso self.story: Optional[Story] = None self.external_reply: Optional[ExternalReplyInfo] = None self.quote: Optional[TextQuote] = None + self.LinkPreviewOptions: Optional[LinkPreviewOptions] = None for key in options: setattr(self, key, options[key])