telegram.InputMediaAnimation

class telegram.InputMediaAnimation(media, thumb=None, caption=None, parse_mode=None, width=None, height=None, duration=None)

Bases: telegram.files.inputmedia.InputMedia

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

type

stranimation.

media

str – File to send. Pass a file_id to send a file that exists on the Telegram servers (recommended), pass an HTTP URL for Telegram to get a file from the Internet. Lastly you can pass an existing telegram.Animation object to send.

thumb

filelike object – Optional. Thumbnail of the file sent. The thumbnail should be in JPEG format and less than 200 kB in size. A thumbnail’s width and height should not exceed 90. Ignored if the file is not is passed as a string or file_id.

caption

str – Optional. Caption of the animation to be sent, 0-200 characters.

parse_mode

str – Optional. Send Markdown or HTML, if you want Telegram apps to show bold, italic, fixed-width text or inline URLs in the media caption. See the constants in telegram.ParseMode for the available modes.

width

int – Optional. Animation width.

height

int – Optional. Animation height.

duration

int – Optional. Animation duration.

Parameters:
  • media (str) – File to send. Pass a file_id to send a file that exists on the Telegram servers (recommended), pass an HTTP URL for Telegram to get a file from the Internet. Lastly you can pass an existing telegram.Animation object to send.
  • thumb (filelike object, optional) – Thumbnail of the file sent. The thumbnail should be in JPEG format and less than 200 kB in size. A thumbnail’s width and height should not exceed 90. Ignored if the file is not is passed as a string or file_id.
  • caption (str, optional) – Caption of the animation to be sent, 0-200 characters.
  • parse_mode (str, optional) – Send Markdown or HTML, if you want Telegram apps to show bold, italic, fixed-width text or inline URLs in the media caption. See the constants in telegram.ParseMode for the available modes.
  • width (int, optional) – Animation width.
  • height (int, optional) – Animation height.
  • duration (int, optional) – Animation duration.

Note

When using a telegram.Animation for the media attribute. It will take the width, height and duration from that video, unless otherwise specified with the optional arguments.