-
Notifications
You must be signed in to change notification settings - Fork 119
Separate callbacks for on_process_result #429
Copy link
Copy link
Open
Labels
enhancementNew feature or requestNew feature or request
Description
I have a dialog that can start several different dialogs, but is limited to have one on_process_result() callback. This is why to distinguish these calls I pass start_data in form of {"intent": "enter_name", "input": ...} and my callback looks like:
match start_data["intent"]:
case "enter_name":
# process input of the name field
...
case "enter_text":
# process input of the text field
...This can produce long and complex callbacks. I wonder if there can be a cleaner way to process results. Thinking a while I've come up with two proposals:
- Pass a callback directly in a dialog's call:
await manager.start(PromptSG.main, promt_params, callback=process_name)`- Use a decorator to mark a function as a callback for a particular dialog:
@dialog.callback_for(PromptDialog)
def process_name(start_data, result, manager)
...Reactions are currently unavailable
Metadata
Metadata
Assignees
Labels
enhancementNew feature or requestNew feature or request