I
I
iliaaaaaaaaaaaaaa2021-08-20 17:15:19
Python
iliaaaaaaaaaaaaaa, 2021-08-20 17:15:19

How to return keyboard ReplyKeyboardMarkup?

In my code, after selecting the command with (ReplyKeyboardMarkup), I run a function in which I need to remove my main bot keyboard.
This is what I did with the command

markup = types.ReplyKeyboardRemove(selective=False)

The question is, after completing the execution of that function, how can I return my main keyboard again?

Answer the question

In order to leave comments, you need to log in

2 answer(s)
R
robprane, 2021-08-20
@robprane

ReplyKeyboardMarkup is added to SendMessage. It is necessary to send a message to the user with a keyboard.

I
Ilhomidin Bakhoraliev, 2021-08-23
@ilhomidin

The fact is that Telegram does not remember your keyboards and you cannot simply take and return the previous one. If the keyboard is static, then just save it as a global variable (this is not the best way, but it works and does not require overengineering) and send a message like "Function completed" with the keyboard after executing that function.

Didn't find what you were looking for?

Ask your question

Ask a Question

731 491 924 answers to any question