Skip to content
Back to top
View this page

# PaidMedia

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

  Bases: `telegram.TelegramObject`

  Describes the paid media added to a message. Currently, it can be one of:

  - `telegram.PaidMediaPreview`

  - `telegram.PaidMediaPhoto`

  - `telegram.PaidMediaVideo`

  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.PaidMediaInfo.paid_media`

  - `telegram.TransactionPartnerUser.paid_media`

  Added in version 21.4.

  Parameters:

    type (`str`) – Type of the paid media.

  type

    Type of the paid media.

    Type:

      `str`

  LIVE_PHOTO = 'live_photo'

    `telegram.constants.PaidMediaType.LIVE_PHOTO`

  PHOTO = 'photo'

    `telegram.constants.PaidMediaType.PHOTO`

  PREVIEW = 'preview'

    `telegram.constants.PaidMediaType.PREVIEW`

  VIDEO = 'video'

    `telegram.constants.PaidMediaType.VIDEO`

  classmethod de_json(data, bot=None)

    Converts JSON data to the appropriate `PaidMedia` 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.