I am writing a telegram bot in Python. I want to send messages with bold letters. I tried to inclose message inside both *
and **
, but it does not solve the problem.
Is there a function for mark up or HTML formatting or a way to do it?
I am writing a telegram bot in Python. I want to send messages with bold letters. I tried to inclose message inside both *
and **
, but it does not solve the problem.
Is there a function for mark up or HTML formatting or a way to do it?
You should use:
bot.send_message(chat_id=chat_id, text="*bold* Example message",
parse_mode=telegram.constants.ParseMode.MARKDOWN_V2)
Or:
bot.send_message(chat_id=chat_id, text='<b>Example message</b>',
parse_mode=telegram.ParseMode.HTML)
This is a little bit late. But i hope to be helpful for others:
import telepot
token = 'xxxxxxxxxxxxxxx' # Your telegram token .
receiver_id = yyyyyyyy # Bot id, you can get this by using the next link :
https://api.telegram.org/bot<TOKEN>/getUpdates. Note that you should
replace <TOKEN> with your token.
bot = telepot.Bot(token)
message = "*YOUR MESSAGE YOU WENT TO SEND.*" #Any characters between ** will be
send in bold format.
bot.sendMessage(receiver_id, message , parse_mode= 'Markdown' )
© 2022 - 2024 — McMap. All rights reserved.