2
0
mirror of https://github.com/pyrogram/pyrogram synced 2025-08-28 21:07:59 +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 date=doc.date
) )
elif types.DocumentAttributeAnimated in attributes: elif types.DocumentAttributeAnimated in attributes:
video_attributes = attributes[types.DocumentAttributeVideo] video_attributes = attributes.get(types.DocumentAttributeVideo, None)
gif = pyrogram_types.GIF( gif = pyrogram_types.GIF(
file_id=encode( file_id=encode(
@ -427,9 +427,9 @@ def parse_messages(
doc.access_hash doc.access_hash
) )
), ),
width=video_attributes.w, width=getattr(video_attributes, "w", 0),
height=video_attributes.h, height=getattr(video_attributes, "h", 0),
duration=video_attributes.duration, duration=getattr(video_attributes, "duration", 0),
thumb=parse_thumb(doc.thumb), thumb=parse_thumb(doc.thumb),
mime_type=doc.mime_type, mime_type=doc.mime_type,
file_size=doc.size, file_size=doc.size,