Skip to content

Commit

Permalink
update command type check order
Browse files Browse the repository at this point in the history
  • Loading branch information
zekroTJA committed Nov 20, 2021
1 parent 1043839 commit b20b8db
Showing 1 changed file with 8 additions and 8 deletions.
16 changes: 8 additions & 8 deletions command.go
Original file line number Diff line number Diff line change
Expand Up @@ -25,14 +25,6 @@ type Command interface {

func toApplicationCommand(c Command) *discordgo.ApplicationCommand {
switch cm := c.(type) {
case SlashCommand:
return &discordgo.ApplicationCommand{
Name: cm.Name(),
Type: discordgo.ChatApplicationCommand,
Description: cm.Description(),
Version: cm.Version(),
Options: cm.Options(),
}
case UserCommand:
return &discordgo.ApplicationCommand{
Name: cm.Name(),
Expand All @@ -43,6 +35,14 @@ func toApplicationCommand(c Command) *discordgo.ApplicationCommand {
Name: cm.Name(),
Type: discordgo.MessageApplicationCommand,
}
case SlashCommand:
return &discordgo.ApplicationCommand{
Name: cm.Name(),
Type: discordgo.ChatApplicationCommand,
Description: cm.Description(),
Version: cm.Version(),
Options: cm.Options(),
}
default:
panic(fmt.Sprintf("Command type not implemented for command: %s", cm.Name()))
}
Expand Down

0 comments on commit b20b8db

Please sign in to comment.