M
M
Maxim Sagaydak2021-04-29 19:06:37
Python
Maxim Sagaydak, 2021-04-29 19:06:37

How to send a message with a button after clicking on the previous one?

Hello, I can’t do it so that after clicking on the button (Inline button), the bot sends another (already different) message, also with a button (Inline button).
Here is an example how it should be:
User
/start
Bot
Hello, click on the button
|_BUTTON_|
I click
Bot
Click also on this
|_BUTTON_|

At the moment, my bot can respond to button presses with a simple message like:
User
/start
Bot
Hello, click on the button
|_BUTTON_|
I click
Bot
Thanks for clicking... And that's all...

How to make it so that when it is clicked, it responds with a message also with a button? I'm still a newbie, please help me.

Here is the code to be improved:
608ad9840ec05037780100.png

Answer the question

In order to leave comments, you need to log in

1 answer(s)
M
MinTnt, 2021-04-29
@CoDeR2006

1) Take out the lines

markup =....
item_hy = ....
markup.add(item_hi)

from sub-function to global level, i.e. put before @bot.message_handler(...)
2) Change line to
bot.send_message(call.message.chat.id, "Всё окей")
bot.send_message(call.message.chat.id, "Нажми ещё эту", reply_markup=markup)

3) Done

Didn't find what you were looking for?

Ask your question

Ask a Question

731 491 924 answers to any question