Browse Source

Add command to list commands

master
Gregory Rudolph 3 years ago
parent
commit
06da80de97
Signed by: rudi
GPG Key ID: EF64F3CBD1A1EBDD
  1. 23
      commands.go

23
commands.go

@ -47,10 +47,10 @@ func setupCommands() { @@ -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() { @@ -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 {

Loading…
Cancel
Save