package command import ( "github.com/bwmarrin/discordgo" ) type ( Router struct { commands map[string]*Command } Command struct { Name string Func CommandFunc NArgs int } CommandFunc func(args []string, s *discordgo.Session, m *discordgo.MessageCreate) error ) func NewRouter() *Router { r := new(Router) r.commands = make(map[string]*Command) return r } func (r *Router) AddCommand(cmd *Command) { r.commands[cmd.Name] = cmd } func (r *Router) GetCommand(name string) (*Command, bool) { cmd, ok := r.commands[name] return cmd, ok }