How to send a colored text message?

Rakete1111 picture Rakete1111 · May 7, 2016 · Viewed 33.3k times · Source

I am trying to send a colored text message to a user as reply, using sendMessage with HTML parsing.

bot.sendMessage(update.message.chat_id, "<span style=\"color:blue\">foo</span>", telegram.ParseMode.HTML)

Sending <span style="color:blue">foo</span> doesn't work, as span is not supported:

Bad Request: Can't parse message text: Unsupported start tag "span" at byte offset 0 (400)

I am using the python-telegram-bot v. 4.0.3.

Is there another way?

Answer

edoput picture edoput · May 8, 2016

Unfortunately there is no documentation about the tag accepted by the bot, except the unit test for parsemode.

The tags that work are b, i, a for bold, italic and link elements, this is what is offered, maybe there's more but I couldn't find it in the docs