InputMedia

class aiogram.types.input_media.InputMedia(*args, **kwargs)[source]

Bases: aiogram.types.base.TelegramObject

This object represents the content of a media message to be sent. It should be one of
  • InputMediaAnimation

  • InputMediaDocument

  • InputMediaAudio

  • InputMediaPhoto

  • InputMediaVideo

That is only base class.

https://core.telegram.org/bots/api#inputmedia

Deserialize object

Parameters
  • conf

  • kwargs

InputMediaAnimation

class aiogram.types.input_media.InputMediaAnimation(media: InputFile, thumb: Union[InputFile, String] = None, caption: String = None, width: Integer = None, height: Integer = None, duration: Integer = None, parse_mode: String = None, **kwargs)[source]

Bases: aiogram.types.input_media.InputMedia

Represents an animation file (GIF or H.264/MPEG-4 AVC video without sound) to be sent.

https://core.telegram.org/bots/api#inputmediaanimation

Deserialize object

Parameters
  • conf

  • kwargs

InputMediaDocument

class aiogram.types.input_media.InputMediaDocument(media: InputFile, thumb: Union[InputFile, String] = None, caption: String = None, parse_mode: String = None, **kwargs)[source]

Bases: aiogram.types.input_media.InputMedia

Represents a photo to be sent.

https://core.telegram.org/bots/api#inputmediadocument

Deserialize object

Parameters
  • conf

  • kwargs

InputMediaAudio

class aiogram.types.input_media.InputMediaAudio(media: InputFile, thumb: Union[InputFile, String] = None, caption: String = None, duration: Integer = None, performer: String = None, title: String = None, parse_mode: String = None, **kwargs)[source]

Bases: aiogram.types.input_media.InputMedia

Represents an audio file to be treated as music to be sent.

https://core.telegram.org/bots/api#inputmediaaudio

Deserialize object

Parameters
  • conf

  • kwargs

InputMediaPhoto

class aiogram.types.input_media.InputMediaPhoto(media: InputFile, thumb: Union[InputFile, String] = None, caption: String = None, parse_mode: String = None, **kwargs)[source]

Bases: aiogram.types.input_media.InputMedia

Represents a photo to be sent.

https://core.telegram.org/bots/api#inputmediaphoto

Deserialize object

Parameters
  • conf

  • kwargs

InputMediaVideo

class aiogram.types.input_media.InputMediaVideo(media: InputFile, thumb: Union[InputFile, String] = None, caption: String = None, width: Integer = None, height: Integer = None, duration: Integer = None, parse_mode: String = None, supports_streaming: Boolean = None, **kwargs)[source]

Bases: aiogram.types.input_media.InputMedia

Represents a video to be sent.

https://core.telegram.org/bots/api#inputmediavideo

Deserialize object

Parameters
  • conf

  • kwargs

MediaGroup

class aiogram.types.input_media.MediaGroup(medias: Optional[List[Union[aiogram.types.input_media.InputMedia, Dict]]] = None)[source]

Bases: aiogram.types.base.TelegramObject

Helper for sending media group

Deserialize object

Parameters
  • conf

  • kwargs

attach_many(*medias: Union[aiogram.types.input_media.InputMedia, Dict])[source]

Attach list of media

Parameters

medias

attach(media: Union[aiogram.types.input_media.InputMedia, Dict])[source]

Attach media

Parameters

media

attach_photo(photo: Union[aiogram.types.input_media.InputMediaPhoto, InputFile], caption: String = None)[source]

Attach photo

Parameters
  • photo

  • caption

attach_video(video: Union[aiogram.types.input_media.InputMediaVideo, InputFile], thumb: Union[InputFile, String] = None, caption: String = None, width: Integer = None, height: Integer = None, duration: Integer = None)[source]

Attach video

Parameters
  • video

  • caption

  • width

  • height

  • duration

to_python() → List[source]

Get object as JSON serializable

Returns