func addHandlers(r victor.Robot) { // Add a typical command that will be displayed using the "help" command // if it is enabled. r.HandleCommand(&victor.HandlerDoc{ CmdHandler: byeFunc, CmdName: "hi", CmdDescription: "Says goodbye when the user says hi!", CmdUsage: []string{""}, }) // Add a hidden command that isn't displayed in the "help" command unless // mentioned by name r.HandleCommand(&victor.HandlerDoc{ CmdHandler: echoFunc, CmdName: "echo", CmdDescription: "Hidden `echo` command!", CmdUsage: []string{"", "`text to echo`"}, CmdIsHidden: true, }) // Add a command to show the "Fields" method r.HandleCommand(&victor.HandlerDoc{ CmdHandler: fieldsFunc, CmdName: "fields", CmdDescription: "Show the fields/parameters of a command message!", CmdUsage: []string{"`param0` `param1` `...`"}, }) // Add a general pattern which is only checked on "non-command" messages // which are described in dispatch.go r.HandlePattern("\b(thanks|thank\\s+you)\b", thanksFunc) // Add default handler to show "unrecognized command" on "command" messages r.SetDefaultHandler(defaultFunc) }