File tree Expand file tree Collapse file tree
Expand file tree Collapse file tree Original file line number Diff line number Diff line change 2020
2121import pyrogram
2222from pyrogram .api import types , functions
23+ from pyrogram .api .errors import StickersetInvalid
2324from .utils import encode
2425
2526# TODO: Organize the code better?
@@ -396,9 +397,12 @@ def parse_message(
396397 sticker_attribute = attributes [types .DocumentAttributeSticker ]
397398
398399 if isinstance (sticker_attribute .stickerset , types .InputStickerSetID ):
399- set_name = client .send (
400- functions .messages .GetStickerSet (sticker_attribute .stickerset )
401- ).set .short_name
400+ try :
401+ set_name = client .send (
402+ functions .messages .GetStickerSet (sticker_attribute .stickerset )
403+ ).set .short_name
404+ except StickersetInvalid :
405+ set_name = None
402406 else :
403407 set_name = None
404408
@@ -417,7 +421,7 @@ def parse_message(
417421 thumb = parse_thumb (doc .thumb ),
418422 # TODO: mask_position
419423 set_name = set_name ,
420- emoji = sticker_attribute .alt ,
424+ emoji = sticker_attribute .alt or None ,
421425 file_size = doc .size ,
422426 mime_type = doc .mime_type ,
423427 file_name = file_name ,
You can’t perform that action at this time.
0 commit comments