W
W
who_someone2019-05-05 15:59:44
Bots
who_someone, 2019-05-05 15:59:44

How to make bold font in Telegram bot?

Hello! You need to make sure that in one message the bot uses both regular and bold fonts. I read the documentation, but did not quite understand how to apply it in practice, more precisely, specifically in my case. Here is an example of my Python code

import telebot
from telebot.types import Message
@bot.message_handler(commands=['start'])
def start_handler(message):
    bot.send_message(message.chat.id, 'Привет, я бот'  + '\n' + 'Здесь должен быть жирный шрифт')

Thanks in advance!

Answer the question

In order to leave comments, you need to log in

3 answer(s)
A
Andrew, 2019-05-05
@who_someone

Here is a code snippet for example:

def test_send_message_with_markdown(self):
    tb = telebot.TeleBot(TOKEN)
    markdown = """
    *bold text*
    _italic text_
    [text](URL)
    """
    ret_msg = tb.send_message(CHAT_ID, markdown, parse_mode="Markdown")
    assert ret_msg.message_id

bot.send_message(CHAT_ID, "*Здесь должен быть жирный шрифт*", parse_mode= "Markdown")

E
Evgeny Kulakov, 2017-04-11
@kulakoff Vue.js

It's a compromise, you decide. If there is not much data, load everything and filter. If there is a lot, then load in portions.

D
Di Ma, 2017-04-11
@dimentimor

If you want to reduce the number of calls to the database, you can prepare the data in advance, write them, for example, to file.json and give it when the page loads. And update it only when some data changes in the database.

Didn't find what you were looking for?

Ask your question

Ask a Question

731 491 924 answers to any question