package core import ( "github.com/bwmarrin/discordgo" "log" ) type Command struct { name string desc string example string command func( s *discordgo.Session, m *discordgo.MessageCreate, message string) } var CommandRegister = make( map[string]Command) func SetCommand( aliases []string, desc string, example string, command func(s *discordgo.Session, m *discordgo.MessageCreate, message string)) { for _, alias := range aliases { c := Command{ name: alias, desc: desc, example: example, command: command} CommandRegister[alias] = c log.Printf("added %s to Register", alias) } } func CommandInit() { SetCommand( []string{"/ggd audio", "/ggd tts"}, "*Attach a TTS version of the message on the channel*", "`/ggd [audio|tts] hello everyone`", MessageAudio) SetCommand( []string{"/ggd voca"}, "Play audio message in vocal channel", "`/ggd voca let's go shopping`", MessageVocal) SetCommand( []string{"ping", "pong"}, "*Check if the bot is alive*", "`[ping|pong]`", MessagePing) SetCommand( []string{"/ggd help", "/ggd info"}, "*Display the available list of commands*", "`/ggd [help|info]`", MessageHelp) SetCommand( []string{"/ggd hat", "/ggd chapeau", "/ggd chapo"}, "*Hand over a set of fancy hats*", "`/ggd [hat|chapeau|chapo]`", MessageHat) }