package commands import ( "velox-bot/internal/commands/fun" "velox-bot/internal/commands/help" cmdlevel "velox-bot/internal/commands/level" "github.com/bwmarrin/discordgo" ) var AllCommands = []*discordgo.ApplicationCommand{ fun.Ping, fun.Joke, fun.Coinflip, fun.Dice, help.Help, cmdlevel.Slvl, cmdlevel.Rank, cmdlevel.Leaderboard, cmdlevel.Rewards, } var handlers = map[string]func(s *discordgo.Session, i *discordgo.InteractionCreate){ "ping": fun.PingHandler, "joke": fun.JokeHandler, "coinflip": fun.CoinflipHandler, "dice": fun.DiceHandler, "help": help.HelpHandler, "slvl": cmdlevel.SlvlHandler, "rank": cmdlevel.RankHandler, "leaderboard": cmdlevel.LeaderboardHandler, "rewards": cmdlevel.RewardsHandler, } func HandleInteraction(s *discordgo.Session, i *discordgo.InteractionCreate) { if h, ok := handlers[i.ApplicationCommandData().Name]; ok { h(s, i) } }