remove.js 3.3 KB

12345678910111213141516171819202122232425262728293031323334353637383940414243444546474849505152535455565758596061626364656667686970717273747576
  1. const { MessageEmbed } = require("discord.js");
  2. const { TrackUtils } = require("erela.js");
  3. module.exports = {
  4. name: "remove",
  5. description: `Remove a song from the queue`,
  6. usage: "[number]",
  7. permissions: {
  8. channel: ["VIEW_CHANNEL", "SEND_MESSAGES", "EMBED_LINKS"],
  9. member: [],
  10. },
  11. aliases: ["rm"],
  12. /**
  13. *
  14. * @param {import("../structures/DiscordMusicBot")} client
  15. * @param {import("discord.js").Message} message
  16. * @param {string[]} args
  17. * @param {*} param3
  18. */
  19. run: async (client, message, args, { GuildDB }) => {
  20. let player = await client.Manager.players.get(message.guild.id);
  21. const song = player.queue.slice(args[0] - 1, 1);
  22. if (!player) return client.sendTime(message.channel, "❌ | **Nothing is playing right now...**");
  23. if (!message.member.voice.channel) return client.sendTime(message.channel, "❌ | **You must be in a voice channel to use this command!**");
  24. //else if(message.guild.me.voice && message.guild.me.voice.channel.id !== message.member.voice.channel.id)return client.sendTime(message.channel, `❌ | **You must be in ${guild.me.voice.channel} to use this command.**`);
  25. if (!player.queue || !player.queue.length || player.queue.length === 0)
  26. return message.channel.send("There is nothing in the queue to remove");
  27. let rm = new MessageEmbed()
  28. .setDescription(`✅ **|** Removed track **\`${Number(args[0])}\`** from the queue!`)
  29. .setColor("GREEN")
  30. if (isNaN(args[0]))rm.setDescription(`**Usage - **${client.config.prefix}\`remove [number]\``);
  31. if (args[0] > player.queue.length)
  32. rm.setDescription(`The queue has only ${player.queue.length} songs!`);
  33. await message.channel.send(rm);
  34. player.queue.remove(Number(args[0]) - 1);
  35. },
  36. SlashCommand: {
  37. options: [
  38. {
  39. name: "remove",
  40. value: "[number]",
  41. type: 4,
  42. required: true,
  43. description: "Remove a song from the queue",
  44. },
  45. ],
  46. /**
  47. *
  48. * @param {import("../structures/DiscordMusicBot")} client
  49. * @param {import("discord.js").Message} message
  50. * @param {string[]} args
  51. * @param {*} param3
  52. */
  53. run: async (client, interaction, args, { GuildDB }) => {
  54. let player = await client.Manager.get(interaction.guild_id);
  55. const song = player.queue.slice(args[0] - 1, 1);
  56. if (!player) return client.sendTime("❌ | **Nothing is playing right now...**");
  57. if (!member.voice.channel) return client.sendTime(interaction, "❌ | **You must be in a voice channel to use this command.**");
  58. 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.**`);
  59. if (!player.queue || !player.queue.length || player.queue.length === 0)
  60. return client.sendTime("❌ | **Nothing is playing right now...**");
  61. let rm = new MessageEmbed()
  62. .setDescription(`✅ **|** Removed track **\`${Number(args[0])}\`** from the queue!`)
  63. .setColor("GREEN")
  64. if (isNaN(args[0]))rm.setDescription(`Usage: ${client.config.prefix}\`remove [number]\``);
  65. if (args[0] > player.queue.length)
  66. rm.setDescription(`The queue has only ${player.queue.length}!`);
  67. await interaction.send(rm);
  68. player.queue.remove(Number(args[0]) - 1);
  69. },
  70. }
  71. };