PaulSonOfLars/gotgbot

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

DukeAnn opened this issue · 3 comments

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.

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 :)

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?

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