How to send bold text on telegram bot

1.1k Views Asked by At

I everyone, I am using telepot to send text and image on my telegram bot. Below an example of my code:

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

getTitle(soup) and getDealPrice(soup) return a string.

How can I bold only getTitle(soup) ?

Thank you so much.

2

There are 2 best solutions below

0
moskino11 On BEST ANSWER

I resolved.

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

)

Thanks

mo1ein

3
mo1ein On

According to doc, use parse_mode.

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