telegram.InputMediaAnimation

class telegram.InputMediaAnimation(media, thumb=None, caption=None, parse_mode=<telegram.utils.helpers.DefaultValue object>, 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

animation.

Type:str
media

Animation to send. Pass a file_id as String to send an animation that exists on the Telegram servers (recommended), pass an HTTP URL as a String for Telegram to get an animation from the Internet, or upload a new animation using multipart/form-data. Lastly you can pass an existing telegram.Animation object to send.

Type:str | filelike object | telegram.Animation
thumb

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 320. Ignored if the file is not is passed as a string or file_id.

Type:filelike object
caption

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

Type:str
parse_mode

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.

Type:str
width

Optional. Animation width.

Type:int
height

Optional. Animation height.

Type:int
duration

Optional. Animation duration.

Type:int
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 320. 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-1024 characters after entities parsing.
  • 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.