mirror of
https://github.com/pyrogram/pyrogram
synced 2025-08-28 21:07:59 +00:00
Move GIF handling before Video to avoid an extra check
This commit is contained in:
parent
feece7e633
commit
4adc55a070
@ -242,7 +242,27 @@ def parse_message(message: types.Message, users: dict, chats: dict) -> pyrogram.
|
|||||||
mime_type=doc.mime_type,
|
mime_type=doc.mime_type,
|
||||||
file_size=doc.size
|
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]
|
video_attributes = attributes[types.DocumentAttributeVideo]
|
||||||
|
|
||||||
if video_attributes.round_message:
|
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
|
# TODO: Emoji, set_name and mask_position
|
||||||
file_size=doc.size,
|
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:
|
else:
|
||||||
document = pyrogram.Document(
|
document = pyrogram.Document(
|
||||||
file_id=encode(
|
file_id=encode(
|
||||||
|
Loading…
x
Reference in New Issue
Block a user