I am using the python-telegram-bot library. When entering the bot for the first time, pressing the ‘/start’ button initiates a conversation which has only a single message. I need all actions to occur within this single message. This message contains text and some buttons.
The menu that appears when the start button is pressed is named ‘main_menu’ in its callback_data, and the buttons below it are numbered with the prefix ‘menu’ in their callback_data (‘menu_1’, ‘menu_2’, and ‘menu_3’). By clicking one of the buttons we enter its submenu.
This time, only the conversation text is edited (no new message is created), and there is a button below it with the callback_data ‘submenu_1_1’. If this button is clicked, the message text changes again, prompting “Ok. The default number is 0. Please enter a number:” asking for a numeric input. After the user sends the number, the same message text should change again and update displaying the previous message with the number the user entered.
In the part where the user sends the number, how to make the bot change the text of the same message again and show the user the number they entered, and re-display the buttons that were in ‘menu_3’? GitHub ‘python-telegram-bot-issue’ at the end of file handlers.py (function get_number_handler
).
Maryam Mirfazaelian is a new contributor to this site. Take care in asking for clarification, commenting, and answering.
Check out our Code of Conduct.
2