用电报机器人发送不同字体的消息

问题描述 投票:-1回答:2

我想用框架python-telegram-bot创建一个电报机器人!

现在,机器人必须发送带有特殊字体的消息,这意味着机器人发送的消息具有不同的漂亮字体,不同于电报字体的字体。

我能怎么做???

python python-telegram-bot
2个回答
1
投票

没有人(即使你是官方)可以发送不同字体/颜色的消息,你可以向@Telegram提出建议,他们会考虑将此添加为功能。

消息文本中的formatting options有限,您可能会喜欢它。


0
投票

您可以使用的唯一颜色是红色或将背景颜色设置为灰色。

str = "`Hello`"     #this will turn the text red on Telegram.
str = "```Hello```" #this will turn the background color gray of the text on Telegram

然后在sendMessage函数中,您需要添加参数parse_mode并将其设置为“Markdown”。

© www.soinside.com 2019 - 2024. All rights reserved.