gpt4 book ai didi

python - 如何使用 Telegram Python 机器人发送粗体文本

转载 作者:太空宇宙 更新时间:2023-11-03 15:47:15 31 4
gpt4 key购买 nike

我正在用 Python 编写 Telegram Bot 。我想用粗体字发送消息。我试图在 *** 中都包含消息,但它并没有解决问题。

是否有用于标记或 HTML 格式化的功能或实现它的方法?

最佳答案

你应该使用:

bot.send_message(chat_id=chat_id, text="*bold* Example message", 
parse_mode=telegram.ParseMode.MARKDOWN)

或者:

bot.send_message(chat_id=chat_id, text='<b>Example message</b>', 
parse_mode=telegram.ParseMode.HTML)

更多信息请访问: https://github.com/python-telegram-bot/python-telegram-bot/wiki/Code-snippets#message-formatting-bold-italic-code-

关于python - 如何使用 Telegram Python 机器人发送粗体文本,我们在Stack Overflow上找到一个类似的问题: https://stackoverflow.com/questions/49327296/

31 4 0
Copyright 2021 - 2024 cfsdn All Rights Reserved 蜀ICP备2022000587号
广告合作:1813099741@qq.com 6ren.com