Skip to content

[FEATURE] Transition states for ConversationHandler #2388

@edenworky

Description

@edenworky

I want to have encapsulated (one file for each) nested conversation handlers, but there's no way to trigger callbacks in a parent conversation (despite being able to trigger a parent state with map_to_parent. The nested conversation example only works because the different conversations are not encapsulated from each other, so a nested conversation can just directly call a callback the parent conversation uses.

I think it would be great to have transitional states. For an example menu, right now a conversation handler sets up the keyboard in the entry point, then goes to a MENU state to handle the updates, and a child conversation needs to call the parent's setup method and then transition to the parent MENU (via map_to_parent). I want the parent's entry to not reply and instead go to a transition SETUP_MENU, which as soon as it's entered sends the menu and transitions to MENU. This way, if I want to go back to the parent menu, I can simply transition from the child conversation to the parent SETUP_MENU and preserve encapsulation.

I considered that this could possibly be achieved with a state that somehow triggers an update for itself, but I don't know self-trigger like that. Either a special handler or tips for self-triggering would be greatly appreciated, and either way it could simplify the nested conversation example quite substantially imo

Metadata

Metadata

Assignees

No one assigned

    Labels

    No labels
    No labels

    Projects

    No projects

    Milestone

    No milestone

    Relationships

    None yet

    Development

    No branches or pull requests

    Issue actions