Gift

class pyrogram.types.Gift

Bases: Object

A star gift.

Parameters:
  • id (int) – Unique star gift identifier.

  • sticker (Sticker, optional) – Information about the star gift sticker.

  • caption (str, optional) – Text message.

  • caption_entities (List of MessageEntity, optional) – For text messages, special entities like usernames, URLs, bot commands, etc. that appear in the text.

  • message_id (int, optional) – Unique message identifier.

  • upgrade_message_id (int, optional) – Unique message identifier. For unique gifts only.

  • name (str, optional) – Name of the star gift. For unique gifts only.

  • title (str, optional) – Title of the star gift. For unique gifts only.

  • collectible_id (int, optional) – Collectible number of the star gift. For unique gifts only.

  • attributes (List of GiftAttribute, optional) – Attributes of the star gift. For unique gifts only.

  • date (datetime, optional) – Date when the star gift was received.

  • first_sale_date (datetime, optional) – Date when the star gift was first purchased.

  • last_sale_date (datetime, optional) – Date when the star gift was last purchased.

  • from_user (User, optional) – User who sent the star gift.

  • owner (Chat, optional) – 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) – 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.

  • convert_price (int, optional) – The number of stars you get if you convert this gift.

  • upgrade_price (int, optional) – The number of stars you need to upgrade this gift.

  • transfer_price (int, optional) – The number of stars you need to transfer this gift.

  • available_amount (int, optional) – The number of gifts available for purchase. Returned only if is_limited is True.

  • resale_amount (int, optional) – The number of gifts available for resale. Returned only if is_limited is True.

  • total_amount (int, optional) – Total amount of gifts. Returned only if is_limited is True.

  • can_upgrade (bool, optional) – True, if the gift can be upgraded.

  • can_export_at (datetime, optional) – Date when the gift can be exported via blockchain.

  • is_limited (bool, optional) – True, if the number of gifts is limited.

  • is_name_hidden (bool, optional) – True, if the sender’s name is hidden.

  • is_saved (bool, optional) – True, if the star gift is saved in profile.

  • is_sold_out (bool, optional) – True, if the star gift is sold out.

  • is_converted (bool, optional) – True, if the gift was converted to Telegram Stars. Only for the receiver of the gift.

  • is_upgraded (bool, optional) – True, if the gift was upgraded.

  • is_refunded (bool, optional) – True, if the gift was refunded.

  • is_transferred (bool, optional) – True, if the gift was transferred.

  • is_birthday (bool, optional) – True, if the gift is a birthday gift.

  • raw (StarGift, optional) – The raw object as received from the server.

  • link (str, property) – A link to the gift. For unique gifts only.

show()

Bound method show of Gift.

Use as a shortcut for:

await client.show_gift(
    message_id=message_id
)

Example

await gift.show()
Returns:

bool – On success, True is returned.

hide()

Bound method hide of Gift.

Use as a shortcut for:

await client.hide_gift(
    message_id=message_id
)

Example

await gift.hide()
Returns:

bool – On success, True is returned.

convert()

Bound method convert of Gift.

Use as a shortcut for:

await client.convert_gift(
    message_id=message_id
)

Example

await gift.convert()
Returns:

bool – On success, True is returned.

upgrade()

Bound method upgrade of Gift.

Use as a shortcut for:

await client.upgrade_gift(
    message_id=message_id
)

Example

await gift.upgrade()
Returns:

bool – On success, True is returned.

transfer(to_chat_id)

Bound method transfer of Gift.

Use as a shortcut for:

await client.transfer_gift(
    message_id=message_id,
    to_chat_id=to_chat_id
)

Example

await gift.transfer(to_chat_id=123)
Returns:

bool – On success, True is returned.

wear()

Bound method wear of Gift.

Note

This works for upgraded gifts only.

Use as a shortcut for:

await client.set_emoji_status(types.EmojiStatus(gift_id=123))

Example

await star_gift.wear()
Returns:

bool – On success, True is returned.