Skip to content
Back to top
View this page

# UniqueGiftInfo

class telegram.UniqueGiftInfo(gift, origin, owned_gift_id=None, transfer_star_count=None, next_transfer_date=None, last_resale_currency=None, last_resale_amount=None, *, api_kwargs=None)

  Bases: `telegram.TelegramObject`

  Describes a service message about a unique gift that was sent or received.

  Objects of this class are comparable in terms of equality. Two objects of this class are considered equal if their `gift`, and `origin` are equal.

  Available In

  `telegram.Message.unique_gift`

  Added in version 22.1.

  Removed in version 22.7: Removed argument and attribute `last_resale_star_count` deprecated since Bot API 9.3.

  Parameters:

    - gift (`UniqueGift`) – Information about the gift.

    - origin (`str`) –

      Origin of the gift. Currently, either `UPGRADE` for gifts upgraded from regular gifts, `TRANSFER` for gifts transferred from other users or channels, `RESALE` for gifts bought from other users, `GIFTED_UPGRADE` for upgrades purchased after the gift was sent, or `OFFER` for gifts bought or sold through gift purchase offers

      Changed in version 22.3: The `RESALE` origin was added.

      Changed in version 22.6: Bot API 9.3 added the `GIFTED_UPGRADE` and `OFFER` origins.

    - owned_gift_id (`str`, optional) – bot; only present for gifts received on behalf of business accounts.

    - transfer_star_count (`int`, optional) – Number of Telegram Stars that must be paid to transfer the gift; omitted if the bot cannot transfer the gift.

    - last_resale_currency (`str`, optional) –

      For gifts bought from other users, the currency in which the payment for the gift was done. Currently, one of `XTR` for Telegram Stars or `TON` for toncoins.

      Added in version 22.6.

    - last_resale_amount (`int`, optional) –

      For gifts bought from other users, the price paid for the gift in either Telegram Stars or nanotoncoins.

      Added in version 22.6.

    - next_transfer_date (`datetime.datetime`, optional) –

      Date when the gift can be transferred. If it’s in the past, then the gift can be transferred now. The default timezone of the bot is used for localization, which is UTC unless `telegram.ext.Defaults.tzinfo` is used.

      Added in version 22.3.

  gift

    Information about the gift.

    Type:

      `UniqueGift`

  origin

    Origin of the gift. Currently, either `UPGRADE` for gifts upgraded from regular gifts, `TRANSFER` for gifts transferred from other users or channels, `RESALE` for gifts bought from other users, `GIFTED_UPGRADE` for upgrades purchased after the gift was sent, or `OFFER` for gifts bought or sold through gift purchase offers

    Changed in version 22.3: The `RESALE` origin was added.

    Changed in version 22.6: Bot API 9.3 added the `GIFTED_UPGRADE` and `OFFER` origins.

    Type:

      `str`

  owned_gift_id

    bot; only present for gifts received on behalf of business accounts.

    Type:

      `str`

  transfer_star_count

    Optional. Number of Telegram Stars that must be paid to transfer the gift; omitted if the bot cannot transfer the gift.

    Type:

      `int`

  last_resale_currency

    Optional. For gifts bought from other users, the currency in which the payment for the gift was done. Currently, one of `XTR` for Telegram Stars or `TON` for toncoins.

    Added in version 22.6.

    Type:

      `str`

  last_resale_amount

    Optional. For gifts bought from other users, the price paid for the gift in either Telegram Stars or nanotoncoins.

    Added in version 22.6.

    Type:

      `int`

  next_transfer_date

    Optional. Date when the gift can be transferred. If it’s in the past, then the gift can be transferred now. The default timezone of the bot is used for localization, which is UTC unless `telegram.ext.Defaults.tzinfo` is used.

    Added in version 22.3.

    Type:

      `datetime.datetime`

  GIFTED_UPGRADE = 'gifted_upgrade'

    `telegram.constants.UniqueGiftInfoOrigin.GIFTED_UPGRADE`

    Added in version 22.6.

  OFFER = 'OFFER'

    `telegram.constants.UniqueGiftInfoOrigin.OFFER`

    Added in version 22.6.

  RESALE = 'resale'

    `telegram.constants.UniqueGiftInfoOrigin.RESALE`

    Added in version 22.3.

  TRANSFER = 'transfer'

    `telegram.constants.UniqueGiftInfoOrigin.TRANSFER`

  UPGRADE = 'upgrade'

    `telegram.constants.UniqueGiftInfoOrigin.UPGRADE`

  classmethod de_json(data, bot=None)

    See `telegram.TelegramObject.de_json()`.