2
0
mirror of https://github.com/pyrogram/pyrogram synced 2025-08-29 13:27:47 +00:00

Some stickers don't have DocumentAttributeImageSize

This commit is contained in:
Dan 2018-04-25 18:30:33 +02:00
parent e22f7896f8
commit 0ed38518e1

View File

@ -393,7 +393,7 @@ def parse_message(
date=doc.date date=doc.date
) )
elif types.DocumentAttributeSticker in attributes: elif types.DocumentAttributeSticker in attributes:
image_size_attributes = attributes[types.DocumentAttributeImageSize] image_size_attributes = attributes.get(types.DocumentAttributeImageSize, None)
sticker_attribute = attributes[types.DocumentAttributeSticker] sticker_attribute = attributes[types.DocumentAttributeSticker]
if isinstance(sticker_attribute.stickerset, types.InputStickerSetID): if isinstance(sticker_attribute.stickerset, types.InputStickerSetID):
@ -416,8 +416,8 @@ def parse_message(
doc.access_hash doc.access_hash
) )
), ),
width=image_size_attributes.w, width=image_size_attributes.w if image_size_attributes else 0,
height=image_size_attributes.h, height=image_size_attributes.h if image_size_attributes else 0,
thumb=parse_thumb(doc.thumb), thumb=parse_thumb(doc.thumb),
# TODO: mask_position # TODO: mask_position
set_name=set_name, set_name=set_name,