refactor(commands): move Command struct to it's own file
This commit is contained in:
@@ -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
|
||||
|
||||
21
internals/discord/bot/commands/commands.go
Normal file
21
internals/discord/bot/commands/commands.go
Normal 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
|
||||
}
|
||||
|
||||
Reference in New Issue
Block a user