mirror of
https://github.com/LonamiWebs/Telethon.git
synced 2024-11-29 12:53:44 +03:00
Return new .web_preview's .photo/.document if present in Message
This commit is contained in:
parent
080585da49
commit
4e07712b04
|
@ -356,6 +356,10 @@ class Message(ChatGetter, SenderGetter, TLObject, abc.ABC):
|
|||
return self.media.photo
|
||||
elif isinstance(self.action, types.MessageActionChatEditPhoto):
|
||||
return self.action.photo
|
||||
else:
|
||||
web = self.web_preview
|
||||
if web and isinstance(web.photo, types.Photo):
|
||||
return web.photo
|
||||
|
||||
@property
|
||||
def document(self):
|
||||
|
@ -366,6 +370,16 @@ class Message(ChatGetter, SenderGetter, TLObject, abc.ABC):
|
|||
if isinstance(self.media, types.MessageMediaDocument):
|
||||
if isinstance(self.media.document, types.Document):
|
||||
return self.media.document
|
||||
else:
|
||||
web = self.web_preview
|
||||
if web and isinstance(web.photo, types.Document):
|
||||
return web.photo
|
||||
|
||||
@property
|
||||
def web_preview(self):
|
||||
if isinstance(self.media, types.MessageMediaWebPage):
|
||||
if isinstance(self.media.webpage, types.WebPage):
|
||||
return self.media.webpage
|
||||
|
||||
@property
|
||||
def audio(self):
|
||||
|
|
Loading…
Reference in New Issue
Block a user