diff --git a/pyrogram/types/messages_and_media/sticker.py b/pyrogram/types/messages_and_media/sticker.py index 56ddf2af..de266b2f 100644 --- a/pyrogram/types/messages_and_media/sticker.py +++ b/pyrogram/types/messages_and_media/sticker.py @@ -148,10 +148,12 @@ class Sticker(Object): sticker: "raw.types.Document", document_attributes: Dict[Type["raw.base.DocumentAttribute"], "raw.base.DocumentAttribute"], ) -> "Sticker": - sticker_attributes = document_attributes.get( - raw.types.DocumentAttributeSticker, - document_attributes[raw.types.DocumentAttributeCustomEmoji] + sticker_attributes = ( + document_attributes[raw.types.DocumentAttributeSticker] + if raw.types.DocumentAttributeSticker in document_attributes + else document_attributes[raw.types.DocumentAttributeCustomEmoji] ) + image_size_attributes = document_attributes.get(raw.types.DocumentAttributeImageSize, None) file_name = getattr(document_attributes.get(raw.types.DocumentAttributeFilename, None), "file_name", None) video_attributes = document_attributes.get(raw.types.DocumentAttributeVideo, None)