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

Handle unknown commands #13

Open
ReeganExE opened this issue Nov 1, 2018 · 2 comments
Open

Handle unknown commands #13

ReeganExE opened this issue Nov 1, 2018 · 2 comments

Comments

@ReeganExE
Copy link

Hi,

Thanks for your great work.

I'm asking for a way to handle unknown commands.
My bot is handling 2 commands as the following.

slack.Command("shout <word>", func(conv hanu.ConversationInterface) {
	str, _ := conv.String("word")
	fmt.Println(conv.Message().Text())
	conv.Reply(strings.ToUpper(str))
})

slack.Command("your version", func(conv hanu.ConversationInterface) {
	conv.Reply("Thanks for asking! I'm running `%s`", "323")
})

I want the bot to reply a message such as I don't understand your command when someone tries to send it an undefined command. Is it possible? Something like:

slack.UnknownCommand(func(conv hanu.ConversationInterface) {
	conv.Reply("Thanks for asking! But I don't understand your command.")
})
@sgreene570
Copy link

+1

I would like any unknown command to default to the help command, just like you would expect when using any CLI application.

@penguinpowernz
Copy link

I added this in PR #14

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

3 participants