discord-multipurpose-bot/commands/music/shuffle.js
2025-09-20 00:27:35 +01:00

22 lines
638 B
JavaScript

const { SlashCommandBuilder } = require("discord.js");
module.exports = {
data: new SlashCommandBuilder()
.setName("shuffle")
.setDescription("Shuffles the current queue"),
async execute(interaction, client) {
const queue = client.distube.getQueue(interaction.guildId);
if (!queue || queue.songs.length <= 2) {
return interaction.reply("❌ Not enough songs in the queue to shuffle!");
}
try {
await queue.shuffle();
interaction.reply("🔀 Shuffled the queue!");
} catch (error) {
console.error(error);
interaction.reply("❌ Failed to shuffle the queue.");
}
},
};