B
B
BronzPlugg2020-10-11 16:51:21
Python
BronzPlugg, 2020-10-11 16:51:21

Trouble with inline keyboard in Python telegram bot?

I decided to write my bot in the cart. Everything went like clockwork, but today I ran into such a problem that I can’t make inline clave. I registered the start command handler, there was also an inline keyboard, everything works fine, I started making the "@bot.callback_query_handler" handler, and it kind of gives out a message after I click on the button, but the problem is that under this message too you need to make an inline keyboard, but alas, I can’t do it, at least by analogy with the start command handler.

@bot.callback_query_handler(func=lambda call: True)
def query_handler(call):
   if call.data == '1':
        bot.send_message(call.message.chat.id, 'TEXT')

Tell me how to do it right.

Answer the question

In order to leave comments, you need to log in

1 answer(s)
C
Chris, 2021-05-23
@data_tx

Do better this way

@bot.callback_query_handler(func=lambda call:True)
def data(call):
    if call.message:
        if call.data == '1':
            bot.send_message(call.message.chat.id, 'TEXT')

Didn't find what you were looking for?

Ask your question

Ask a Question

731 491 924 answers to any question