Skip to content

Commit

Permalink
Added the field link_preview_options to the class Message with infor…
Browse files Browse the repository at this point in the history
…mation about the link preview options used to send the message.
  • Loading branch information
coder2020official committed Dec 29, 2023
1 parent 0485c31 commit a261174
Showing 1 changed file with 9 additions and 0 deletions.
9 changes: 9 additions & 0 deletions telebot/types.py
Original file line number Diff line number Diff line change
Expand Up @@ -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`
Expand Down Expand Up @@ -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
Expand Down Expand Up @@ -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])
Expand Down

0 comments on commit a261174

Please sign in to comment.