Having difficulties trying to understand how nested ConversationHandlers work python-telegram-bot

Viewed 14

I'm having problems trying to understand nested ConversationHandlers. My objective would be, as you can see, to nest EDIT_SUBJECTS_HANDLER into the MENU_QUERY_HANDLER so that when the EDIT_SUBJECTS process ends, it leads back to the menu, but I'm stuck trying to undestand how it works and I am also having difficulties with the examples on github. Is there anyone that could explain to me the process and maybe fix my code to make it work?.

EDIT_SUBJECTS_HANDLER = ConversationHandler(
    entry_points=[
        CallbackQueryHandler(edit_subjects.display_subjects, "edit_subjects")],
    states={
        "select_subjects": [CallbackQueryHandler(edit_subjects.select_subjects)],
        "add_subjects": [MessageHandler(filters.TEXT, edit_user_subjects)],
    },
    fallbacks=[],
)

MENU_QUERY_HANDLER = ConversationHandler(
    entry_points=[CommandHandler("menu", menu)],
    states={
        "selector": [CallbackQueryHandler(selector)],
        "edit_subjects": [EDIT_SUBJECTS_HANDLER],
    },
    fallbacks=[],
)
0 Answers
Related