diff --git a/pyrogram/types/payments/star_gift.py b/pyrogram/types/payments/star_gift.py index ac74a2432..86f047ed0 100644 --- a/pyrogram/types/payments/star_gift.py +++ b/pyrogram/types/payments/star_gift.py @@ -361,11 +361,11 @@ async def _parse_action( symbol = None for key, value in attributes.items(): - if isinstance(key, raw.types.StarGiftAttributeModel): + if key is raw.types.StarGiftAttributeModel: model = await types.StarGiftAttribute._parse(client, value) - elif isinstance(key, raw.types.StarGiftAttributeBackdrop): - backdrop = await types.StarGiftAttribute._parse(client, value) - elif isinstance(key, raw.types.StarGiftAttributePattern): + elif key is raw.types.StarGiftAttributeBackdrop: + backdrop = await types.StarGiftAttribute._parse(client, value, True) + elif key is raw.types.StarGiftAttributePattern: symbol = await types.StarGiftAttribute._parse(client, value) return StarGift( diff --git a/pyrogram/types/payments/star_gift_attribute.py b/pyrogram/types/payments/star_gift_attribute.py index ceab50555..d72ef3a45 100644 --- a/pyrogram/types/payments/star_gift_attribute.py +++ b/pyrogram/types/payments/star_gift_attribute.py @@ -67,14 +67,18 @@ def __init__( async def _parse( client, attr: "raw.base.StarGiftAttribute", + backdrop: bool = False, ) -> "StarGiftAttribute": - doc = attr.document - attributes = {type(i): i for i in doc.attributes} + sticker = None + if not backdrop: + doc = attr.document + attributes = {type(i): i for i in doc.attributes} + sticker = await types.Sticker._parse(client, doc, attributes) return StarGiftAttribute( name=attr.name, type=enums.StarGiftAttributeType(type(attr)), - sticker=await types.Sticker._parse(client, doc, attributes), + sticker=sticker, rarity=attr.rarity_permille, client=client )