Skip to content
Back to top
View this page

# InputPaidMedia

class telegram.InputPaidMedia(type, media, *, api_kwargs=None)

  Bases: `telegram.TelegramObject`

  Base class for Telegram InputPaidMedia Objects. Currently, it can be one of:

  - `telegram.InputPaidMediaPhoto`

  - `telegram.InputPaidMediaVideo`

  See also

  Working with Files and Media

  Use In

  `telegram.Bot.send_paid_media()`

  Added in version 21.4.

  Parameters:

    - type (`str`) – Type of media that the instance represents.

    - media (`str` | `InputFile`) – File to send. Pass a `file_id` as String to send a file that exists on the Telegram servers (recommended), pass an HTTP URL as a String for Telegram to get a file from the Internet, or upload a new one. To upload a file, you can either pass a file object (e.g. `open("filename", "rb")`) or the file contents as bytes. If the bot is running in `local_mode`, passing the path of the file (as string or `pathlib.Path` object) is supported as well.

  type

    Type of the input media.

    Type:

      `str`

  media

    Media to send.

    Type:

      `str` | `telegram.InputFile`

  PHOTO = 'photo'

    `telegram.constants.InputPaidMediaType.PHOTO`

  VIDEO = 'video'

    `telegram.constants.InputPaidMediaType.VIDEO`