How can I write bold in python telegram bot [duplicate]

随声附和 提交于 2019-12-10 21:25:18

问题


I am writing a telegram bot in python. I want to print messages with bold letters. I tried to use * and **, but it does not help. Is there a function for formatting or a way to do it?


回答1:


You should use:

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

Or:

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

More info at: https://github.com/python-telegram-bot/python-telegram-bot/wiki/Code-snippets#message-formatting-bold-italic-code-



来源:https://stackoverflow.com/questions/49327296/how-can-i-write-bold-in-python-telegram-bot

易学教程内所有资源均来自网络或用户发布的内容,如有违反法律规定的内容欢迎反馈
该文章没有解决你所遇到的问题?点击提问,说说你的问题,让更多的人一起探讨吧!