MCPcopy Index your code
hub / github.com/python-telegram-bot/python-telegram-bot / send_document

Method send_document

src/telegram/_bot.py:1810–1971  ·  view source on GitHub ↗

Use this method to send general files. Bots can currently send files of any type of up to :tg-const:`telegram.constants.FileSizeLimit.FILESIZE_UPLOAD` in size, this limit may be changed in the future. .. seealso:: :wiki:`Working with Files and Media <Workin

(
        self,
        chat_id: int | str,
        document: "FileInput | Document",
        caption: str | None = None,
        disable_notification: ODVInput[bool] = DEFAULT_NONE,
        reply_markup: "ReplyMarkup | None" = None,
        parse_mode: ODVInput[str] = DEFAULT_NONE,
        disable_content_type_detection: bool | None = None,
        caption_entities: Sequence["MessageEntity"] | None = None,
        protect_content: ODVInput[bool] = DEFAULT_NONE,
        message_thread_id: int | 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,
        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,
    )

Source from the content-addressed store, hash-verified

1808 )
1809
1810 async def send_document(
1811 self,
1812 chat_id: int | str,
1813 document: "FileInput | Document",
1814 caption: str | None = None,
1815 disable_notification: ODVInput[bool] = DEFAULT_NONE,
1816 reply_markup: "ReplyMarkup | None" = None,
1817 parse_mode: ODVInput[str] = DEFAULT_NONE,
1818 disable_content_type_detection: bool | None = None,
1819 caption_entities: Sequence["MessageEntity"] | None = None,
1820 protect_content: ODVInput[bool] = DEFAULT_NONE,
1821 message_thread_id: int | None = None,
1822 thumbnail: "FileInput | None" = None,
1823 reply_parameters: "ReplyParameters | None" = None,
1824 business_connection_id: str | None = None,
1825 message_effect_id: str | None = None,
1826 allow_paid_broadcast: bool | None = None,
1827 direct_messages_topic_id: int | None = None,
1828 suggested_post_parameters: "SuggestedPostParameters | None" = None,
1829 *,
1830 allow_sending_without_reply: ODVInput[bool] = DEFAULT_NONE,
1831 reply_to_message_id: int | None = None,
1832 filename: str | None = None,
1833 read_timeout: ODVInput[float] = DEFAULT_NONE,
1834 write_timeout: ODVInput[float] = DEFAULT_NONE,
1835 connect_timeout: ODVInput[float] = DEFAULT_NONE,
1836 pool_timeout: ODVInput[float] = DEFAULT_NONE,
1837 api_kwargs: JSONDict | None = None,
1838 ) -> Message:
1839 """
1840 Use this method to send general files.
1841
1842 Bots can currently send files of any type of up to
1843 :tg-const:`telegram.constants.FileSizeLimit.FILESIZE_UPLOAD` in size, this limit may be
1844 changed in the future.
1845
1846 .. seealso:: :wiki:`Working with Files and Media <Working-with-Files-and-Media>`
1847
1848 .. versionchanged:: 20.5
1849 |removed_thumb_arg|
1850
1851 Args:
1852 chat_id (:obj:`int` | :obj:`str`): |chat_id_channel|
1853 document (:obj:`str` | :term:`file object` | :class:`~telegram.InputFile` | \
1854 :obj:`bytes` | :class:`pathlib.Path` | :class:`telegram.Document`): File to send.
1855 |fileinput|
1856 Lastly you can pass an existing :class:`telegram.Document` object to send.
1857
1858 Note:
1859 Sending by URL will currently only work ``GIF``, ``PDF`` & ``ZIP`` files.
1860
1861 .. versionchanged:: 13.2
1862 Accept :obj:`bytes` as input.
1863
1864 .. versionchanged:: 20.0
1865 File paths as input is also accepted for bots *not* running in
1866 :paramref:`~telegram.Bot.local_mode`.
1867 caption (:obj:`str`, optional): Document caption (may also be used when resending

Calls 2

_parse_file_inputMethod · 0.95
_send_messageMethod · 0.95