How to Bold Text in Telepot Telegram Bot

How can I bold text in telepot Telegram bot?

You need to provide a parse_mode Parameter (parse_mode="Markdown").

Or else you will not see any markdown style.

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

See

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

How to send bold text using Telegram Python bot

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-

How to send bold text on telegram bot

I resolved.

bot.sendPhoto(
'@XXXXXXXXXX',
getImage(soup),
parse_mode='Markdown',
caption = '*' + getTitle(soup)+ '*' + '*' + getDealPrice(soup) + '*',
disable_notification=True

)

Thanks

mo1ein

style inline keyboard in telepot

solved!

example code:

bot.sendMessage(chat_id, 'testing custom keyboard',reply_markup = InlineKeyboardMarkup(inline_keyboard=[
[InlineKeyboardButton(text="btn1",callback_data='I have Nothing To do'), InlineKeyboardButton(text="btn2",callback_data='0'),InlineKeyboardButton(text="btn3",callback_data='0'), InlineKeyboardButton(text="btn4",callback_data='0')],
[InlineKeyboardButton(text="btn1",callback_data='yep')]
]
))

result:

keyboard result

How to send a hyperlink in bot.sendMessage()

You can use formatting option to do this.



Related Topics



Leave a reply



Submit