diff --git a/internals/discord/bot/commands/channels.go b/internals/discord/bot/commands/channels.go index caa4dea..eebc49e 100644 --- a/internals/discord/bot/commands/channels.go +++ b/internals/discord/bot/commands/channels.go @@ -6,10 +6,6 @@ import ( dgo "github.com/bwmarrin/discordgo" ) -type Command interface { - Info() *dgo.ApplicationCommand - Handle(s *dgo.Session, i *dgo.InteractionCreate) error -} type ManageChannel struct { db guilddb.GuildDB diff --git a/internals/discord/bot/commands/commands.go b/internals/discord/bot/commands/commands.go new file mode 100644 index 0000000..81b0ace --- /dev/null +++ b/internals/discord/bot/commands/commands.go @@ -0,0 +1,21 @@ +package commands + +import ( + dgo "github.com/bwmarrin/discordgo" +) + +type Command interface { + Info() *dgo.ApplicationCommand + Handle(s *dgo.Session, i *dgo.InteractionCreate) error +} +func getOptions(i *dgo.InteractionCreate) map[string]*dgo.ApplicationCommandInteractionDataOption { + opts := i.ApplicationCommandData().Options + m := make(map[string]*dgo.ApplicationCommandInteractionDataOption, len(opts)) + + for _, opt := range opts { + m[opt.Name] = opt + } + + return m +} +