MCPcopy Create free account
hub / github.com/eternnoir/pyTelegramBotAPI / send_message

Method send_message

telebot/__init__.py:1751–1892  ·  view source on GitHub ↗

Use this method to send text messages. Warning: Do not send more than about 4096 characters each message, otherwise you'll risk an HTTP 414 error. If you must send more than 4096 characters, use the `split_string` or `smart_split` function in util.py. Teleg

(
            self, chat_id: Union[int, str], text: str,
            parse_mode: Optional[str]=None,
            entities: Optional[List[types.MessageEntity]]=None,
            disable_web_page_preview: Optional[bool]=None,    # deprecated, for backward compatibility
            disable_notification: Optional[bool]=None,
            protect_content: Optional[bool]=None,
            reply_to_message_id: Optional[int]=None,          # deprecated, for backward compatibility
            allow_sending_without_reply: Optional[bool]=None, # deprecated, for backward compatibility
            reply_markup: Optional[REPLY_MARKUP_TYPES]=None,
            timeout: Optional[int]=None,
            message_thread_id: Optional[int]=None,
            reply_parameters: Optional[types.ReplyParameters]=None,
            link_preview_options : Optional[types.LinkPreviewOptions]=None,
            business_connection_id: Optional[str]=None,
            message_effect_id: Optional[str]=None,
            allow_paid_broadcast: Optional[bool]=None,
            direct_messages_topic_id: Optional[int]=None,
            suggested_post_parameters: Optional[types.SuggestedPostParameters]=None)

Source from the content-addressed store, hash-verified

1749
1750
1751 def send_message(
1752 self, chat_id: Union[int, str], text: str,
1753 parse_mode: Optional[str]=None,
1754 entities: Optional[List[types.MessageEntity]]=None,
1755 disable_web_page_preview: Optional[bool]=None, # deprecated, for backward compatibility
1756 disable_notification: Optional[bool]=None,
1757 protect_content: Optional[bool]=None,
1758 reply_to_message_id: Optional[int]=None, # deprecated, for backward compatibility
1759 allow_sending_without_reply: Optional[bool]=None, # deprecated, for backward compatibility
1760 reply_markup: Optional[REPLY_MARKUP_TYPES]=None,
1761 timeout: Optional[int]=None,
1762 message_thread_id: Optional[int]=None,
1763 reply_parameters: Optional[types.ReplyParameters]=None,
1764 link_preview_options : Optional[types.LinkPreviewOptions]=None,
1765 business_connection_id: Optional[str]=None,
1766 message_effect_id: Optional[str]=None,
1767 allow_paid_broadcast: Optional[bool]=None,
1768 direct_messages_topic_id: Optional[int]=None,
1769 suggested_post_parameters: Optional[types.SuggestedPostParameters]=None) -> types.Message:
1770 """
1771 Use this method to send text messages.
1772
1773 Warning: Do not send more than about 4096 characters each message, otherwise you'll risk an HTTP 414 error.
1774 If you must send more than 4096 characters,
1775 use the `split_string` or `smart_split` function in util.py.
1776
1777 Telegram documentation: https://core.telegram.org/bots/api#sendmessage
1778
1779 :param chat_id: Unique identifier for the target chat or username of the target channel (in the format @channelusername)
1780 :type chat_id: :obj:`int` or :obj:`str`
1781
1782 :param text: Text of the message to be sent
1783 :type text: :obj:`str`
1784
1785 :param parse_mode: Mode for parsing entities in the message text.
1786 :type parse_mode: :obj:`str`
1787
1788 :param entities: List of special entities that appear in message text, which can be specified instead of parse_mode
1789 :type entities: Array of :class:`telebot.types.MessageEntity`
1790
1791 :param disable_web_page_preview: deprecated.
1792 :type disable_web_page_preview: :obj:`bool`
1793
1794 :param disable_notification: Sends the message silently. Users will receive a notification with no sound.
1795 :type disable_notification: :obj:`bool`
1796
1797 :param protect_content: Protects the contents of the sent message from forwarding and saving
1798 :type protect_content: :obj:`bool`
1799
1800 :param reply_to_message_id: deprecated.
1801 :type reply_to_message_id: :obj:`int`
1802
1803 :param allow_sending_without_reply: deprecated.
1804 :type allow_sending_without_reply: :obj:`bool`
1805
1806 :param reply_markup: Additional interface options. A JSON-serialized object for an inline keyboard, custom reply keyboard, instructions to remove reply keyboard or to force a reply from the user.
1807 :type reply_markup: :class:`telebot.types.InlineKeyboardMarkup` or :class:`telebot.types.ReplyKeyboardMarkup` or :class:`telebot.types.ReplyKeyboardRemove`
1808 or :class:`telebot.types.ForceReply`

Calls 1

de_jsonMethod · 0.45