send_document()

Client.send_document()

Send generic files.

Usable by Users Bots

Parameters:
  • chat_id (int | str) – Unique identifier (int) or username (str) of the target chat. For your personal cloud (Saved Messages) you can simply use “me” or “self”. For a contact that exists in your Telegram address book you can use his phone number (str). You can also use chat public link in form of t.me/<username> (str).

  • document (str | BinaryIO) – File to send. Pass a file_id as string to send a file that exists on the Telegram servers, pass an HTTP URL as a string for Telegram to get a file from the Internet, pass a file path as string to upload a new file that exists on your local machine, or pass a binary file-like object with its attribute “.name” set for in-memory uploads.

  • thumb (str | BinaryIO, 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 pixels. Thumbnails can’t be reused and can be only uploaded as a new file.

  • caption (str, optional) – Document caption, 0-1024 characters.

  • parse_mode (ParseMode, optional) – By default, texts are parsed using both Markdown and HTML styles. You can combine both syntaxes together.

  • caption_entities (List of MessageEntity) – List of special entities that appear in the caption, which can be specified instead of parse_mode.

  • file_name (str, optional) – File name of the document sent. Defaults to file’s path basename.

  • force_document (bool, optional) – Pass True to force sending files as document.

  • disable_notification (bool, optional) – Sends the message silently.

  • message_thread_id (int, optional) – Unique identifier for the target message thread.

  • business_connection_id (str, optional) – Business connection identifier.

  • reply_to_message_id (int, optional) – If the message is a reply, ID of the original message.

  • reply_to_story_id (int, optional) – Unique identifier for the target story.

  • reply_to_chat_id (int | str, optional) – Unique identifier for the origin chat.

  • reply_to_monoforum_id (int | str, optional) – Unique identifier for the target user of monoforum.

  • quote_text (str, optional) – Text to quote.

  • quote_entities (List of MessageEntity, optional) – Entities in quote_text.

  • message_effect_id (int 64-bit, optional) – Message effect id.

  • schedule_date (datetime, optional) – Date when the message will be sent.

  • protect_content (bool, optional) – Protects content.

  • allow_paid_broadcast (bool, optional) – Ignore broadcast limits.

  • reply_markup – Reply markup.

  • progress – Progress callback.

  • progress_args – Extra args.

Returns:

Message | None