- Added new music commands: play, queue, and volume. - Implemented music management using disgolink for Lavalink integration. - Updated bot initialization to include Lavalink host and password. - Enhanced interaction handling for music commands, requiring DJ role for usage. - Introduced now playing message with interactive buttons for controlling playback. - Updated dependencies in go.mod for disgolink and snowflake.
68 lines
1.8 KiB
Go
68 lines
1.8 KiB
Go
package commands
|
|
|
|
import (
|
|
"velox-bot/internal/commands/fun"
|
|
"velox-bot/internal/commands/help"
|
|
cmdlevel "velox-bot/internal/commands/level"
|
|
"velox-bot/internal/commands/meeting"
|
|
cmdmusic "velox-bot/internal/commands/music"
|
|
"velox-bot/internal/commands/projects"
|
|
"velox-bot/internal/music"
|
|
|
|
"github.com/bwmarrin/discordgo"
|
|
)
|
|
|
|
var AllCommands = []*discordgo.ApplicationCommand{
|
|
fun.Ping,
|
|
fun.Joke,
|
|
fun.Coinflip,
|
|
fun.Dice,
|
|
fun.Rps,
|
|
fun.RpsStats,
|
|
fun.RpsLeaderboard,
|
|
help.Help,
|
|
cmdlevel.Slvl,
|
|
cmdlevel.Rank,
|
|
cmdlevel.Leaderboard,
|
|
cmdlevel.Rewards,
|
|
cmdmusic.Play,
|
|
cmdmusic.Queue,
|
|
cmdmusic.Volume,
|
|
meeting.Meeting,
|
|
projects.Projects,
|
|
}
|
|
|
|
var handlers = map[string]func(s *discordgo.Session, i *discordgo.InteractionCreate){
|
|
"ping": fun.PingHandler,
|
|
"joke": fun.JokeHandler,
|
|
"coinflip": fun.CoinflipHandler,
|
|
"dice": fun.DiceHandler,
|
|
"rps": fun.RpsHandler,
|
|
"rpsstats": fun.RpsStatsHandler,
|
|
"rpsleaderboard": fun.RpsLeaderboardHandler,
|
|
"help": help.HelpHandler,
|
|
"slvl": cmdlevel.SlvlHandler,
|
|
"rank": cmdlevel.RankHandler,
|
|
"leaderboard": cmdlevel.LeaderboardHandler,
|
|
"rewards": cmdlevel.RewardsHandler,
|
|
"meeting": meeting.MeetingHandler,
|
|
"projects": projects.ProjectsHandler,
|
|
"play": cmdmusic.PlayHandler,
|
|
"queue": cmdmusic.QueueHandler,
|
|
"volume": cmdmusic.VolumeHandler,
|
|
}
|
|
|
|
func HandleInteraction(s *discordgo.Session, i *discordgo.InteractionCreate) {
|
|
switch i.Type {
|
|
case discordgo.InteractionApplicationCommand:
|
|
if h, ok := handlers[i.ApplicationCommandData().Name]; ok {
|
|
h(s, i)
|
|
}
|
|
case discordgo.InteractionMessageComponent:
|
|
data := i.MessageComponentData()
|
|
if len(data.CustomID) >= 6 && data.CustomID[:6] == "music:" {
|
|
music.HandleComponent(s, i)
|
|
}
|
|
}
|
|
}
|