2
0
mirror of https://github.com/pyrogram/pyrogram synced 2025-08-28 12:57:52 +00:00

Move GIF handling before Video to avoid an extra check

This commit is contained in:
Dan 2018-04-05 08:22:27 +02:00
parent feece7e633
commit 4adc55a070

View File

@ -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(