InputMedia

class telegram.InputMedia(media_type, media, caption=None, caption_entities=None, parse_mode=None, *, api_kwargs=None)[source]

Bases: telegram.TelegramObject

Base class for Telegram InputMedia Objects.

Changed in version 20.0: Added arguments and attributes type, media, caption, caption_entities, parse_mode.

Parameters:
type[source]

Type of the input media.

Type:

str

media[source]

Media to send.

Type:

str | telegram.InputFile

caption[source]

Optional. Caption of the media to be sent, 0-1024 characters after entities parsing.

Type:

str

parse_mode[source]

Optional. Mode for parsing entities. See telegram.constants.ParseMode and formatting options for more details.

Type:

str

caption_entities[source]

Optional. Tuple of special entities that appear in the caption, which can be specified instead of parse_mode.

Changed in version 20.0:

  • This attribute is now an immutable tuple.

  • This attribute is now always a tuple, that may be empty.

Type:

tuple[telegram.MessageEntity]