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.PingCommand,
	help.HelpCommand,
	cmdlevel.LevelConfigCommand,
	cmdlevel.RankCommand,
	cmdlevel.LeaderboardCommand,
}

var handlers = map[string]func(s *discordgo.Session, i *discordgo.InteractionCreate){
	"ping": fun.HandlePing,
	"help": help.HandleHelp,
	"slvl": cmdlevel.HandleLevelConfig,
	"rank": cmdlevel.HandleRank,
	"leaderboard": cmdlevel.HandleLeaderboard,
}

func HandleInteraction(s *discordgo.Session, i *discordgo.InteractionCreate) {
	if h, ok := handlers[i.ApplicationCommandData().Name]; ok {
		h(s, i)
	}
}
