Skip to content
New issue

Have a question about this project? Sign up for a free GitHub account to open an issue and contact its maintainers and the community.

By clicking “Sign up for GitHub”, you agree to our terms of service and privacy statement. We’ll occasionally send you account related emails.

Already on GitHub? Sign in to your account

I want to interrupt the Conversation when receiving any command command or text route #181

Open
DukeAnn opened this issue Jul 17, 2024 · 3 comments

Comments

@DukeAnn
Copy link

DukeAnn commented Jul 17, 2024

I want to interrupt the Conversation when receiving any command command or text route。
Because many users are halfway through the operation. It may have been replaced by other operations and no termination command was sent.

@PaulSonOfLars
Copy link
Owner

Hi! You should be able to do this by setting a message handler on any command message as an exit for your conversation.

Have a look at the conversation handler struct for all the available options :)

@DukeAnn
Copy link
Author

DukeAnn commented Jul 17, 2024

That is to say, I must write the exit message routing in

// Exits is the list of handlers to exit the current conversation partway (eg /cancel commands). This returns
// EndConversation() by default, unless otherwise specified.
Exits[]ext.Handler

What I expect is that sending /start or other commands will interrupt the Conversation. I have many Conversations and I can't write all the routing commands for each one. Are there any other solutions or cases?

@PaulSonOfLars
Copy link
Owner

Hi, thanks for your patience on my reply.

It's up to you to keep track of which exits to handle - thats not something the library can handle, as all conversations are entirely separate from the library's perspective

Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment
Labels
None yet
Projects
None yet
Development

No branches or pull requests

2 participants