refactor(commands): move Command struct to it's own file

This commit is contained in:
Gustavo "Guz" L. de Mello
2024-08-19 20:22:28 -03:00
parent c48360efbd
commit fde981eefc
2 changed files with 21 additions and 4 deletions

View File

@@ -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

View File

@@ -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
}