首页 > 解决方案 > 如何在 Telepot Telegram 机器人中加粗文本?

问题描述

我试过这个

elif command == 'bold':
    telegram_bot.sendMessage (chat_id, str("*bold*"), reply_markup=markup)

但它正在回复*bold*而不是粗体

标签: pythonpython-3.xtelegram-bottelepot

解决方案


您需要提供一个parse_mode参数 (parse_mode="Markdown")。

否则您将看不到任何降价样式。

sendMessage(chat_id, "*this text is bold*", parse_mode= 'Markdown') 

https://telepot.readthedocs.io/en/latest/reference.html#telepot.Bot.sendMessage


推荐阅读