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

Method send_message

src/telegram/_bot.py:1016–1160  ·  view source on GitHub ↗

Use this method to send text messages. Args: chat_id (:obj:`int` | :obj:`str`): |chat_id_channel| text (:obj:`str`): Text of the message to be sent. Max :tg-const:`telegram.constants.MessageLimit.MAX_TEXT_LENGTH` characters after entit

(
        self,
        chat_id: int | str,
        text: str,
        parse_mode: ODVInput[str] = DEFAULT_NONE,
        entities: Sequence["MessageEntity"] | None = None,
        disable_notification: ODVInput[bool] = DEFAULT_NONE,
        protect_content: ODVInput[bool] = DEFAULT_NONE,
        reply_markup: "ReplyMarkup | None" = None,
        message_thread_id: int | None = None,
        link_preview_options: ODVInput["LinkPreviewOptions"] = DEFAULT_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,
        disable_web_page_preview: bool | 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

1014 return self._bot_user
1015
1016 async def send_message(
1017 self,
1018 chat_id: int | str,
1019 text: str,
1020 parse_mode: ODVInput[str] = DEFAULT_NONE,
1021 entities: Sequence["MessageEntity"] | None = None,
1022 disable_notification: ODVInput[bool] = DEFAULT_NONE,
1023 protect_content: ODVInput[bool] = DEFAULT_NONE,
1024 reply_markup: "ReplyMarkup | None" = None,
1025 message_thread_id: int | None = None,
1026 link_preview_options: ODVInput["LinkPreviewOptions"] = DEFAULT_NONE,
1027 reply_parameters: "ReplyParameters | None" = None,
1028 business_connection_id: str | None = None,
1029 message_effect_id: str | None = None,
1030 allow_paid_broadcast: bool | None = None,
1031 direct_messages_topic_id: int | None = None,
1032 suggested_post_parameters: "SuggestedPostParameters | None" = None,
1033 *,
1034 allow_sending_without_reply: ODVInput[bool] = DEFAULT_NONE,
1035 reply_to_message_id: int | None = None,
1036 disable_web_page_preview: bool | None = None,
1037 read_timeout: ODVInput[float] = DEFAULT_NONE,
1038 write_timeout: ODVInput[float] = DEFAULT_NONE,
1039 connect_timeout: ODVInput[float] = DEFAULT_NONE,
1040 pool_timeout: ODVInput[float] = DEFAULT_NONE,
1041 api_kwargs: JSONDict | None = None,
1042 ) -> Message:
1043 """Use this method to send text messages.
1044
1045 Args:
1046 chat_id (:obj:`int` | :obj:`str`): |chat_id_channel|
1047 text (:obj:`str`): Text of the message to be sent. Max
1048 :tg-const:`telegram.constants.MessageLimit.MAX_TEXT_LENGTH` characters after
1049 entities parsing.
1050 parse_mode (:obj:`str`): |parse_mode|
1051 entities (Sequence[:class:`telegram.MessageEntity`], optional): Sequence of special
1052 entities that appear in message text, which can be specified instead of
1053 :paramref:`parse_mode`.
1054
1055 .. versionchanged:: 20.0
1056 |sequenceargs|
1057 link_preview_options (:obj:`LinkPreviewOptions`, optional): Link preview generation
1058 options for the message. Mutually exclusive with
1059 :paramref:`disable_web_page_preview`.
1060
1061 .. versionadded:: 20.8
1062
1063 disable_notification (:obj:`bool`, optional): |disable_notification|
1064 protect_content (:obj:`bool`, optional): |protect_content|
1065
1066 .. versionadded:: 13.10
1067
1068 reply_markup (:class:`InlineKeyboardMarkup` | :class:`ReplyKeyboardMarkup` | \
1069 :class:`ReplyKeyboardRemove` | :class:`ForceReply`, optional):
1070 Additional interface options. An object for an inline keyboard, custom reply
1071 keyboard, instructions to remove reply keyboard or to force a reply from the user.
1072 message_thread_id (:obj:`int`, optional): |message_thread_id_arg|
1073

Calls 2

_send_messageMethod · 0.95
parse_lpo_and_dwppFunction · 0.90