mirror of
https://github.com/Mayuri-Chan/pyrofork.git
synced 2025-12-29 20:14:51 +00:00
Move GIF handling before Video to avoid an extra check
This commit is contained in:
parent
feece7e633
commit
4adc55a070
1 changed files with 21 additions and 21 deletions
|
|
@ -242,7 +242,27 @@ def parse_message(message: types.Message, users: dict, chats: dict) -> pyrogram.
|
|||
mime_type=doc.mime_type,
|
||||
file_size=doc.size
|
||||
)
|
||||
elif types.DocumentAttributeVideo in attributes and types.DocumentAttributeAnimated not in attributes:
|
||||
elif types.DocumentAttributeAnimated in attributes:
|
||||
document = pyrogram.Document(
|
||||
file_id=encode(
|
||||
pack(
|
||||
"<iiqq",
|
||||
10,
|
||||
doc.dc_id,
|
||||
doc.id,
|
||||
doc.access_hash
|
||||
)
|
||||
),
|
||||
thumb=parse_thumb(doc.thumb),
|
||||
file_name=getattr(
|
||||
attributes.get(
|
||||
types.DocumentAttributeFilename, None
|
||||
), "file_name", None
|
||||
),
|
||||
mime_type=doc.mime_type,
|
||||
file_size=doc.size
|
||||
)
|
||||
elif types.DocumentAttributeVideo in attributes:
|
||||
video_attributes = attributes[types.DocumentAttributeVideo]
|
||||
|
||||
if video_attributes.round_message:
|
||||
|
|
@ -298,26 +318,6 @@ def parse_message(message: types.Message, users: dict, chats: dict) -> pyrogram.
|
|||
# TODO: Emoji, set_name and mask_position
|
||||
file_size=doc.size,
|
||||
)
|
||||
elif types.DocumentAttributeAnimated in attributes:
|
||||
document = pyrogram.Document(
|
||||
file_id=encode(
|
||||
pack(
|
||||
"<iiqq",
|
||||
10,
|
||||
doc.dc_id,
|
||||
doc.id,
|
||||
doc.access_hash
|
||||
)
|
||||
),
|
||||
thumb=parse_thumb(doc.thumb),
|
||||
file_name=getattr(
|
||||
attributes.get(
|
||||
types.DocumentAttributeFilename, None
|
||||
), "file_name", None
|
||||
),
|
||||
mime_type=doc.mime_type,
|
||||
file_size=doc.size
|
||||
)
|
||||
else:
|
||||
document = pyrogram.Document(
|
||||
file_id=encode(
|
||||
|
|
|
|||
Loading…
Reference in a new issue