Skip to content
Back to top
View this page

# OwnedGift

class telegram.OwnedGift(type, *, api_kwargs=None)

  Bases: `telegram.TelegramObject`

  This object describes a gift received and owned by a user or a chat. Currently, it can be one of:

  - `telegram.OwnedGiftRegular`

  - `telegram.OwnedGiftUnique`

  Objects of this class are comparable in terms of equality. Two objects of this class are considered equal, if their `type` is equal.

  Available In

  `telegram.OwnedGifts.gifts`

  Added in version 22.1.

  Parameters:

    type (`str`) – Type of the owned gift.

  type

    Type of the owned gift.

    Type:

      `str`

  REGULAR = 'regular'

    `telegram.constants.OwnedGiftType.REGULAR`

  UNIQUE = 'unique'

    `telegram.constants.OwnedGiftType.UNIQUE`

  classmethod de_json(data, bot=None)

    Converts JSON data to the appropriate `OwnedGift` object, i.e. takes care of selecting the correct subclass.

    Parameters:

      - data (dict[`str`, …]) – The JSON data.

      - bot (`telegram.Bot`, optional) – The bot associated with this object.

    Returns:

      The Telegram object.