From 06da80de97eb9a125850d54effb0c526c7b5abd3 Mon Sep 17 00:00:00 2001 From: Gregory Rudolph Date: Wed, 5 May 2021 23:09:29 -0400 Subject: [PATCH] Add command to list commands --- commands.go | 23 ++++++++++++++++++++--- 1 file changed, 20 insertions(+), 3 deletions(-) diff --git a/commands.go b/commands.go index 44dcd7e..83d1755 100644 --- a/commands.go +++ b/commands.go @@ -47,10 +47,10 @@ func setupCommands() { commands = append(commands, addQuote) snap := Command{ - Name: "Snap", + Name: "Snap", RequiresAdmin: false, - Keywords: []string{"snap", "purge", "sn"}, - Exec: Snap, + Keywords: []string{"snap", "purge", "sn"}, + Exec: Snap, } commands = append(commands, snap) @@ -61,6 +61,23 @@ func setupCommands() { Exec: Status, } commands = append(commands, status) + + listCommands := Command{ + Name: "List Commands", + RequiresAdmin: false, + Keywords: []string{"help", "commands", "cmd", "cmds"}, + Exec: Commands, + } + commands = append(commands, listCommands) +} + +func Commands(b BotCommand) bool { + defer log.PanicSafe() + print := "Available commands:\n" + for _, cmd := range commands { + print += fmt.Sprintf("```%+v\n%+v\n%+v```\n", cmd.Name, cmd.Keywords, cmd.Help) + } + return true } func Reboot(b BotCommand) bool {