Add command to list commands
This commit is contained in:
23
commands.go
23
commands.go
@ -47,10 +47,10 @@ func setupCommands() {
|
|||||||
commands = append(commands, addQuote)
|
commands = append(commands, addQuote)
|
||||||
|
|
||||||
snap := Command{
|
snap := Command{
|
||||||
Name: "Snap",
|
Name: "Snap",
|
||||||
RequiresAdmin: false,
|
RequiresAdmin: false,
|
||||||
Keywords: []string{"snap", "purge", "sn"},
|
Keywords: []string{"snap", "purge", "sn"},
|
||||||
Exec: Snap,
|
Exec: Snap,
|
||||||
}
|
}
|
||||||
commands = append(commands, snap)
|
commands = append(commands, snap)
|
||||||
|
|
||||||
@ -61,6 +61,23 @@ func setupCommands() {
|
|||||||
Exec: Status,
|
Exec: Status,
|
||||||
}
|
}
|
||||||
commands = append(commands, 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 {
|
func Reboot(b BotCommand) bool {
|
||||||
|
|||||||
Reference in New Issue
Block a user