Answer the question
In order to leave comments, you need to log in
How to implement exit button from settings?
The essence of the question is this, I can’t understand how to implement an exit button from the settings of any of the parameters so that after returning to the menu, the implementation of the change functions also stops
@bot.callback_query_handler(func=lambda call: True)
def callback_worker(call):
if call.data == "info":
bot.send_message(chat_id, "Ім‘я: " + name + "\nСтать: " + sex + "\nВік: " + str(age))
if call.data == "settings":
bot.send_message(chat_id,"Налаштування: ", reply_markup=keyboard_settings)
if call.data == "exit":
main_menu()
if call.data == "change_name":
msg = bot.send_message(chat_id, "Введіть нове ім‘я, або натисніть \"Назад\":", reply_markup=keyboard_exit)
bot.register_next_step_handler(msg, edit_settings, 'name')
if call.data == "change_sex":
msg = bot.send_message(chat_id, "Введіть нову стать, або натисніть \"Назад\":", reply_markup=keyboard_exit)
bot.register_next_step_handler(msg, edit_settings, 'sex')
if call.data == "change_age":
msg = bot.send_message(chat_id, "Введіть новий вік, або натисніть \"Назад\":", reply_markup=keyboard_exit)
bot.register_next_step_handler(msg, edit_settings, 'age')
if call.data == "escape":
bot.send_message(chat_id, "Налаштування: ", reply_markup=keyboard_settings)
Answer the question
In order to leave comments, you need to log in
Didn't find what you were looking for?
Ask your questionAsk a Question
731 491 924 answers to any question