diff --git a/pyrogram/types/payments/gift.py b/pyrogram/types/payments/gift.py index 348a937d..2af51f66 100644 --- a/pyrogram/types/payments/gift.py +++ b/pyrogram/types/payments/gift.py @@ -77,13 +77,16 @@ class Gift(Object): User who sent the star gift. owner (:obj:`~pyrogram.types.Chat`, *optional*): - Current gift owner. + Only available if the nfts is in telegram. owner_name (``str``, *optional*): Name of the user who received the star gift. owner_address (``str``, *optional*): - Address of the gift owner in TON blockchain. + Only available if the nfts is in ton network. + + ton_address (``str``, *optional*): + Only available if the nfts is in ton network. price (``int``, *optional*): Price of this gift in stars. @@ -141,7 +144,7 @@ class Gift(Object): raw (:obj:`~pyrogram.raw.base.StarGift`, *optional*): The raw object as received from the server. - + link (``str``, *property*): A link to the gift. For unique gifts only. @@ -163,6 +166,7 @@ class Gift(Object): owner: Optional["types.Chat"] = None, owner_name: Optional[str] = None, owner_address: Optional[str] = None, + ton_address: Optional[str] = None, price: Optional[int] = None, convert_price: Optional[int] = None, upgrade_price: Optional[int] = None, @@ -201,6 +205,7 @@ class Gift(Object): self.owner = owner self.owner_name = owner_name self.owner_address = owner_address + self.ton_address = ton_address self.price = price self.convert_price = convert_price self.upgrade_price = upgrade_price @@ -233,7 +238,7 @@ class Gift(Object): return await Gift._parse_unique(client, gift, users, chats) elif isinstance(gift, raw.types.StarGiftSaved): return await Gift._parse_saved(client, gift, users, chats) - + @staticmethod async def _parse_regular( client, @@ -277,9 +282,15 @@ class Gift(Object): ) or None, available_amount=getattr(star_gift, "availability_issued", None), total_amount=getattr(star_gift, "availability_total", None), - owner=types.Chat._parse_chat(client, users.get(owner_id) or chats.get(owner_id)), + owner=( + types.Chat._parse_chat(client, users.get(owner_id) or + chats.get(owner_id)) + if owner_id is not None + else None + ), owner_name=getattr(star_gift, "owner_name", None), owner_address=getattr(star_gift, "owner_address", None), + ton_address=getattr(star_gift, "gift_address", None), is_upgraded=True, raw=star_gift, client=client