mirror of
https://github.com/LonamiWebs/Telethon.git
synced 2024-11-23 01:46:35 +03:00
Provide easier access to media through NewMessage event
This commit is contained in:
parent
c79fbe451f
commit
91ba50174a
|
@ -316,6 +316,24 @@ class NewMessage(_EventBuilder):
|
|||
def forward(self):
|
||||
return self.message.fwd_from
|
||||
|
||||
@property
|
||||
def media(self):
|
||||
return self.message.media
|
||||
|
||||
@property
|
||||
def photo(self):
|
||||
if isinstance(self.message.media, types.MessageMediaPhoto):
|
||||
photo = self.message.media.photo
|
||||
if isinstance(photo, types.Photo):
|
||||
return photo
|
||||
|
||||
@property
|
||||
def document(self):
|
||||
if isinstance(self.message.media, types.MessageMediaDocument):
|
||||
doc = self.message.media.document
|
||||
if isinstance(doc, types.Document):
|
||||
return doc
|
||||
|
||||
@property
|
||||
def out(self):
|
||||
return self.message.out
|
||||
|
|
Loading…
Reference in New Issue
Block a user