loopqueue.js 2.9 KB

1234567891011121314151617181920212223242526272829303132333435363738394041424344454647484950515253545556575859606162
  1. const { MessageEmbed } = require("discord.js");
  2. const { TrackUtils } = require("erela.js");
  3. module.exports = {
  4. name: "loopqueue",
  5. description: "Loop the whole queue",
  6. usage: "",
  7. permissions: {
  8. channel: ["VIEW_CHANNEL", "SEND_MESSAGES", "EMBED_LINKS"],
  9. member: [],
  10. },
  11. aliases: ["lq", "repeatqueue", "rq"],
  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.get(message.guild.id);
  21. if (!player) return client.sendTime(message.channel, "❌ | **Nothing is playing right now...**");
  22. if (!message.member.voice.channel) return client.sendTime(message.channel, "❌ | **You must be in a voice channel to use this command!**");
  23. //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.**`);
  24. if (player.QueueRepeat) {
  25. player.setQueueRepeat(false)
  26. client.sendTime(message.channel, `Queue loop \`disabled\``);
  27. } else {
  28. player.setQueueRepeat(true)
  29. client.sendTime(message.channel, `Queue loop \`enabled\``);
  30. }
  31. },
  32. SlashCommand: {
  33. /**
  34. *
  35. * @param {import("../structures/DiscordMusicBot")} client
  36. * @param {import("discord.js").Message} message
  37. * @param {string[]} args
  38. * @param {*} param3
  39. */
  40. run: async (client, interaction, args, { GuildDB }) => {
  41. let player = await client.Manager.get(interaction.guild_id);
  42. const guild = client.guilds.cache.get(interaction.guild_id);
  43. const member = guild.members.cache.get(interaction.member.user.id);
  44. const voiceChannel = member.voice.channel;
  45. let awaitchannel = client.channels.cache.get(interaction.channel_id); /// thanks Reyansh for this idea ;-;
  46. if (!player) return client.sendTime(interaction, "❌ | **Nothing is playing right now...**");
  47. if (!member.voice.channel) return client.sendTime(interaction, "❌ | **You must be in a voice channel to use this command.**");
  48. if (guild.me.voice.channel && !guild.me.voice.channel.equals(voiceChannel)) return client.sendTime(interaction, `❌ | **You must be in ${guild.me.voice.channel} to use this command.**`);
  49. if(player.queueRepeat){
  50. player.setQueueRepeat(false)
  51. client.sendTime(interaction, `Queue loop \`disabled\``);
  52. }else{
  53. player.setQueueRepeat(true)
  54. client.sendTime(interaction, `Queue loop \`enabled\``);
  55. }
  56. console.log(interaction.data)
  57. }
  58. }
  59. };