From 294511cf46ede6d5f6b0a67bf7e932cba52ece00 Mon Sep 17 00:00:00 2001 From: Siwoo Jeon Date: Sat, 21 Jun 2025 09:59:28 +0900 Subject: [PATCH] refactor: use switch --- handler/interactionCreate.go | 7 ++++--- 1 file changed, 4 insertions(+), 3 deletions(-) diff --git a/handler/interactionCreate.go b/handler/interactionCreate.go index 4dfbbbc..224b70a 100644 --- a/handler/interactionCreate.go +++ b/handler/interactionCreate.go @@ -6,12 +6,13 @@ import ( ) 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) return - } else if i.Type == discordgo.InteractionMessageComponent { + case discordgo.InteractionMessageComponent: commands.Discommand.ComponentRun(s, i) - } else if i.Type == discordgo.InteractionModalSubmit { + case discordgo.InteractionModalSubmit: commands.Discommand.ModalRun(s, i) } }