refactor: use switch
This commit is contained in:
parent
631111165a
commit
294511cf46
1 changed files with 4 additions and 3 deletions
|
@ -6,12 +6,13 @@ import (
|
||||||
)
|
)
|
||||||
|
|
||||||
func InteractionCreate(s *discordgo.Session, i *discordgo.InteractionCreate) {
|
func InteractionCreate(s *discordgo.Session, i *discordgo.InteractionCreate) {
|
||||||
if i.Type == discordgo.InteractionApplicationCommand {
|
switch i.Type {
|
||||||
|
case discordgo.InteractionApplicationCommand:
|
||||||
commands.Discommand.ChatInputRun(i.ApplicationCommandData().Name, s, i)
|
commands.Discommand.ChatInputRun(i.ApplicationCommandData().Name, s, i)
|
||||||
return
|
return
|
||||||
} else if i.Type == discordgo.InteractionMessageComponent {
|
case discordgo.InteractionMessageComponent:
|
||||||
commands.Discommand.ComponentRun(s, i)
|
commands.Discommand.ComponentRun(s, i)
|
||||||
} else if i.Type == discordgo.InteractionModalSubmit {
|
case discordgo.InteractionModalSubmit:
|
||||||
commands.Discommand.ModalRun(s, i)
|
commands.Discommand.ModalRun(s, i)
|
||||||
}
|
}
|
||||||
}
|
}
|
||||||
|
|
Loading…
Reference in a new issue