From 0ed38518e1d6f4109d089011866b81f82221a4dd Mon Sep 17 00:00:00 2001 From: Dan <14043624+delivrance@users.noreply.github.com> Date: Wed, 25 Apr 2018 18:30:33 +0200 Subject: [PATCH] Some stickers don't have DocumentAttributeImageSize --- pyrogram/client/message_parser.py | 6 +++--- 1 file changed, 3 insertions(+), 3 deletions(-) diff --git a/pyrogram/client/message_parser.py b/pyrogram/client/message_parser.py index 6bbd93e6..6e930ac4 100644 --- a/pyrogram/client/message_parser.py +++ b/pyrogram/client/message_parser.py @@ -393,7 +393,7 @@ def parse_message( date=doc.date ) elif types.DocumentAttributeSticker in attributes: - image_size_attributes = attributes[types.DocumentAttributeImageSize] + image_size_attributes = attributes.get(types.DocumentAttributeImageSize, None) sticker_attribute = attributes[types.DocumentAttributeSticker] if isinstance(sticker_attribute.stickerset, types.InputStickerSetID): @@ -416,8 +416,8 @@ def parse_message( doc.access_hash ) ), - width=image_size_attributes.w, - height=image_size_attributes.h, + width=image_size_attributes.w if image_size_attributes else 0, + height=image_size_attributes.h if image_size_attributes else 0, thumb=parse_thumb(doc.thumb), # TODO: mask_position set_name=set_name,