mirror of
https://github.com/LonamiWebs/Telethon.git
synced 2025-02-04 05:34:41 +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
|
Helper method to return the document only if it has an attribute
|
||||||
that's an instance of the given kind, and passes the condition.
|
that's an instance of the given kind, and passes the condition.
|
||||||
"""
|
"""
|
||||||
for attr in self.document.attributes:
|
doc = self.document
|
||||||
|
if doc:
|
||||||
|
for attr in doc.attributes:
|
||||||
if isinstance(attr, kind):
|
if isinstance(attr, kind):
|
||||||
if not condition or condition(self.document):
|
if not condition or condition(doc):
|
||||||
return self.document
|
return doc
|
||||||
|
return None
|
||||||
|
|
||||||
# endregion Private Methods
|
# endregion Private Methods
|
||||||
|
|
Loading…
Reference in New Issue
Block a user