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

Fix some GIF not having video attributes

This commit is contained in:
Dan 2018-05-20 12:45:37 +02:00
parent 1cd7e28b50
commit 5b300ef83c

View File

@ -415,7 +415,7 @@ def parse_messages(
date=doc.date
)
elif types.DocumentAttributeAnimated in attributes:
video_attributes = attributes[types.DocumentAttributeVideo]
video_attributes = attributes.get(types.DocumentAttributeVideo, None)
gif = pyrogram_types.GIF(
file_id=encode(
@ -427,9 +427,9 @@ def parse_messages(
doc.access_hash
)
),
width=video_attributes.w,
height=video_attributes.h,
duration=video_attributes.duration,
width=getattr(video_attributes, "w", 0),
height=getattr(video_attributes, "h", 0),
duration=getattr(video_attributes, "duration", 0),
thumb=parse_thumb(doc.thumb),
mime_type=doc.mime_type,
file_size=doc.size,