Use this method to send animation files (GIF or H.264/MPEG-4 AVC video without sound). Bots can currently send animation files of up to :tg-const:`telegram.constants.FileSizeLimit.FILESIZE_UPLOAD` in size, this limit may be changed in the future. Note:
(
self,
chat_id: int | str,
animation: "FileInput | Animation",
duration: TimePeriod | None = None,
width: int | None = None,
height: int | None = None,
caption: str | None = None,
parse_mode: ODVInput[str] = DEFAULT_NONE,
disable_notification: ODVInput[bool] = DEFAULT_NONE,
reply_markup: "ReplyMarkup | None" = None,
caption_entities: Sequence["MessageEntity"] | None = None,
protect_content: ODVInput[bool] = DEFAULT_NONE,
message_thread_id: int | None = None,
has_spoiler: bool | None = None,
thumbnail: "FileInput | None" = None,
reply_parameters: "ReplyParameters | None" = None,
business_connection_id: str | None = None,
message_effect_id: str | None = None,
allow_paid_broadcast: bool | None = None,
show_caption_above_media: bool | None = None,
direct_messages_topic_id: int | None = None,
suggested_post_parameters: "SuggestedPostParameters | None" = None,
*,
allow_sending_without_reply: ODVInput[bool] = DEFAULT_NONE,
reply_to_message_id: int | None = None,
filename: str | None = None,
read_timeout: ODVInput[float] = DEFAULT_NONE,
write_timeout: ODVInput[float] = DEFAULT_NONE,
connect_timeout: ODVInput[float] = DEFAULT_NONE,
pool_timeout: ODVInput[float] = DEFAULT_NONE,
api_kwargs: JSONDict | None = None,
)
| 2461 | ) |
| 2462 | |
| 2463 | async def send_animation( |
| 2464 | self, |
| 2465 | chat_id: int | str, |
| 2466 | animation: "FileInput | Animation", |
| 2467 | duration: TimePeriod | None = None, |
| 2468 | width: int | None = None, |
| 2469 | height: int | None = None, |
| 2470 | caption: str | None = None, |
| 2471 | parse_mode: ODVInput[str] = DEFAULT_NONE, |
| 2472 | disable_notification: ODVInput[bool] = DEFAULT_NONE, |
| 2473 | reply_markup: "ReplyMarkup | None" = None, |
| 2474 | caption_entities: Sequence["MessageEntity"] | None = None, |
| 2475 | protect_content: ODVInput[bool] = DEFAULT_NONE, |
| 2476 | message_thread_id: int | None = None, |
| 2477 | has_spoiler: bool | None = None, |
| 2478 | thumbnail: "FileInput | None" = None, |
| 2479 | reply_parameters: "ReplyParameters | None" = None, |
| 2480 | business_connection_id: str | None = None, |
| 2481 | message_effect_id: str | None = None, |
| 2482 | allow_paid_broadcast: bool | None = None, |
| 2483 | show_caption_above_media: bool | None = None, |
| 2484 | direct_messages_topic_id: int | None = None, |
| 2485 | suggested_post_parameters: "SuggestedPostParameters | None" = None, |
| 2486 | *, |
| 2487 | allow_sending_without_reply: ODVInput[bool] = DEFAULT_NONE, |
| 2488 | reply_to_message_id: int | None = None, |
| 2489 | filename: str | None = None, |
| 2490 | read_timeout: ODVInput[float] = DEFAULT_NONE, |
| 2491 | write_timeout: ODVInput[float] = DEFAULT_NONE, |
| 2492 | connect_timeout: ODVInput[float] = DEFAULT_NONE, |
| 2493 | pool_timeout: ODVInput[float] = DEFAULT_NONE, |
| 2494 | api_kwargs: JSONDict | None = None, |
| 2495 | ) -> Message: |
| 2496 | """ |
| 2497 | Use this method to send animation files (GIF or H.264/MPEG-4 AVC video without sound). |
| 2498 | Bots can currently send animation files of up to |
| 2499 | :tg-const:`telegram.constants.FileSizeLimit.FILESIZE_UPLOAD` in size, this limit may be |
| 2500 | changed in the future. |
| 2501 | |
| 2502 | Note: |
| 2503 | :paramref:`thumbnail` will be ignored for small files, for which Telegram can easily |
| 2504 | generate thumbnails. However, this behaviour is undocumented and might be changed |
| 2505 | by Telegram. |
| 2506 | |
| 2507 | .. seealso:: :wiki:`Working with Files and Media <Working-with-Files-and-Media>` |
| 2508 | |
| 2509 | .. versionchanged:: 20.5 |
| 2510 | |removed_thumb_arg| |
| 2511 | |
| 2512 | Args: |
| 2513 | chat_id (:obj:`int` | :obj:`str`): |chat_id_channel| |
| 2514 | animation (:obj:`str` | :term:`file object` | :class:`~telegram.InputFile` | \ |
| 2515 | :obj:`bytes` | :class:`pathlib.Path` | :class:`telegram.Animation`): Animation to |
| 2516 | send. |fileinput| |
| 2517 | Lastly you can pass an existing :class:`telegram.Animation` object to send. |
| 2518 | |
| 2519 | .. versionchanged:: 13.2 |
| 2520 | Accept :obj:`bytes` as input. |