python - 如何在 Telepot Telegram 机器人中将文本加粗?

标签 python python-3.x telegram-bot telepot

我已经尝试过了

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

但它回复的是*bold*而不是bold

最佳答案

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

否则你将看不到任何 Markdown 样式。

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

查看

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

关于python - 如何在 Telepot Telegram 机器人中将文本加粗?,我们在Stack Overflow上找到一个类似的问题: https://stackoverflow.com/questions/52163959/

相关文章:

python - 类型注释稍后定义的类(前向引用)

python-3.x - 您如何将 Google Login (Oauth2) 限制为来自 Flask WebApp 的特定 Google Apps 域的电子邮件?

linux - 如何使用pip将python34模块tweepy安装到树莓派上

redis - 如何在聊天机器人中管理上下文/状态?

python - Pandas:将 WinZipped csv 文件转换为 Data Frame

python - lxml 返回 DTD 属性的空列表

python csv.dictreader 不使用 data.gov csv

Python : SpaqrlWrapper, 超时?

go - InlineKeyboard + Webhook

php - 在带有图像的 Telegram Bot 中发送消息