package commands import ( "context" "fmt" "github.com/disgoorg/disgo/discord" "github.com/disgoorg/disgo/events" ) type ShuffleCommand struct { deps *Dependencies } func NewShuffleCommand(deps *Dependencies) *ShuffleCommand { return &ShuffleCommand{deps: deps} } func (c *ShuffleCommand) Definition() discord.ApplicationCommandCreate { return discord.SlashCommandCreate{ Name: "shuffle", Description: "Shuffles the upcoming tracks in the queue", } } func (c *ShuffleCommand) Execute(ctx context.Context, event *events.ApplicationCommandInteractionCreate) error { gid, err := requirePlaybackAccess(c.deps.Discord, event) if err != nil { return err } count := c.deps.Music.Guild(gid).Shuffle() if count == 0 { return reply(event, "The queue is empty, nothing to shuffle.") } return reply(event, fmt.Sprintf("Shuffled **%d** queued track(s).", count)) }