M
M
Medici2020-07-31 16:26:59
Bots
Medici, 2020-07-31 16:26:59

How to make a post button with text inside?

For example, the button is the Answer, inside the button the text is the solution.

Answer the question

In order to leave comments, you need to log in

1 answer(s)
I
IKIQ, 2020-09-06
@IKIQ

For example, you can try

...
def question(message):
    keyboard = types.InlineKeyboardMarkup(row_width=2)
    a = types.InlineKeyboardButton(text="Ответ", callback_data="get_answer")
    keyboard.add(a) 
    bot.send_message(chat_id, "Вопрос", reply_markup = keyboard)
    
@bot.callback_query_handler(func=lambda call: call.data == 'get_answer') #call: call.data == 'some_data'
def callback_get_answer(call):
    if call.message:
        bot.send_message(chat_id, "Ответ", reply_markup = "")

Didn't find what you were looking for?

Ask your question

Ask a Question

731 491 924 answers to any question