From 803f8f0073a38a3c0724354e76f1f358fa5c252d Mon Sep 17 00:00:00 2001 From: Dan <14043624+delivrance@users.noreply.github.com> Date: Sun, 14 Aug 2022 22:37:09 +0200 Subject: [PATCH] Fix Sticker parsing --- pyrogram/types/messages_and_media/sticker.py | 8 +++++--- 1 file changed, 5 insertions(+), 3 deletions(-) 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)