Skip to content

Handle unknown commands #13

@ReeganExE

Description

@ReeganExE

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.")
})

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