shuffle.js 2.2 KB

123456789101112131415161718192021222324252627282930313233343536373839404142434445
  1. const { MessageEmbed } = require("discord.js");
  2. module.exports = {
  3. name: "shuffle",
  4. description: "Shuffles the queue",
  5. usage: "",
  6. permissions: {
  7. channel: ["VIEW_CHANNEL", "SEND_MESSAGES", "EMBED_LINKS"],
  8. member: [],
  9. },
  10. aliases: ["shuff"],
  11. /**
  12. *
  13. * @param {import("../structures/DiscordMusicBot")} client
  14. * @param {import("discord.js").Message} message
  15. * @param {string[]} args
  16. * @param {*} param3
  17. */
  18. run: async (client, message, args, { GuildDB }) => {
  19. let player = await client.Manager.get(message.guild.id);
  20. if (!player) return client.sendTime(message.channel, "❌ | **Nothing is playing right now...**");
  21. if (!message.member.voice.channel) return client.sendTime(message.channel, "❌ | **You must be in a voice channel to use this command!**");
  22. if (!player.queue || !player.queue.length || player.queue.length === 0) return message.channel.send("Not enough songs in the queue to shuffle!");
  23. player.queue.shuffle();
  24. let embed = new MessageEmbed().setColor("RANDOM").setDescription(`Shuffled the queue!`);
  25. await message.channel.send(embed);
  26. await message.react("✅");
  27. },
  28. SlashCommand: {
  29. run: async (client, interaction, args, { GuildDB }) => {
  30. const guild = client.guilds.cache.get(interaction.guild_id);
  31. const member = guild.members.cache.get(interaction.member.user.id);
  32. if (!member.voice.channel) return client.sendTime(interaction, "❌ | **You must be in a voice channel to use this command.**");
  33. if (guild.me.voice.channel && !guild.me.voice.channel.equals(member.voice.channel)) return client.sendTime(interaction, `❌ | **You must be in ${guild.me.voice.channel} to use this command.**`);
  34. let player = await client.Manager.get(interaction.guild_id);
  35. if (!player) return client.sendTime(interaction.channel, "❌ | **Nothing is playing right now...**");
  36. if (!player.queue || !player.queue.length || player.queue.length === 0) return interaction.send("Not enough songs in the queue to shuffle!");
  37. player.queue.shuffle();
  38. interaction.send("Shuffled the queue!");
  39. },
  40. },
  41. };