Skip to content

Commit 842d7bc

Browse files
Add owned_gift_id property to Gift class
1 parent ea97294 commit 842d7bc

1 file changed

Lines changed: 10 additions & 0 deletions

File tree

  • pyrogram/types/messages_and_media

pyrogram/types/messages_and_media/gift.py

Lines changed: 10 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -453,6 +453,16 @@ def link(self) -> Optional[str]:
453453

454454
return f"https://t.me/nft/{self.name}"
455455

456+
@property
457+
def owned_gift_id(self) -> Optional[str]:
458+
if not self.is_upgraded:
459+
return None
460+
461+
if self.owner and self.owner.type != enums.ChatType.PRIVATE:
462+
return f"{self.owner.id}_{self.message_id}"
463+
elif self.message_id:
464+
return str(self.message_id)
465+
456466
async def show(self) -> bool:
457467
"""Bound method *show* of :obj:`~pyrogram.types.Gift`.
458468

0 commit comments

Comments
 (0)