mirror of
https://github.com/LonamiWebs/Telethon.git
synced 2025-01-25 00:34:19 +03:00
Fix _document_by_attribute failing on empty media
This commit is contained in:
parent
4e5b8c9c34
commit
11ef4ce370
|
@ -700,9 +700,12 @@ class Message(ChatGetter, SenderGetter, TLObject, abc.ABC):
|
|||
Helper method to return the document only if it has an attribute
|
||||
that's an instance of the given kind, and passes the condition.
|
||||
"""
|
||||
for attr in self.document.attributes:
|
||||
if isinstance(attr, kind):
|
||||
if not condition or condition(self.document):
|
||||
return self.document
|
||||
doc = self.document
|
||||
if doc:
|
||||
for attr in doc.attributes:
|
||||
if isinstance(attr, kind):
|
||||
if not condition or condition(doc):
|
||||
return doc
|
||||
return None
|
||||
|
||||
# endregion Private Methods
|
||||
|
|
Loading…
Reference in New Issue
Block a user