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,
	help.Help,
	cmdlevel.Slvl,
	cmdlevel.Rank,
	cmdlevel.Leaderboard,
	cmdlevel.Rewards,
}

var handlers = map[string]func(s *discordgo.Session, i *discordgo.InteractionCreate){
	"ping": fun.PingHandler,
	"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)
	}
}
