loop.js 2.7 KB

12345678910111213141516171819202122232425262728293031323334353637383940414243444546474849505152535455565758596061
  1. const { MessageEmbed } = require("discord.js");
  2. const { TrackUtils } = require("erela.js");
  3. module.exports = {
  4. name: "loop",
  5. description: "Loop the current song",
  6. usage: "",
  7. permissions: {
  8. channel: ["VIEW_CHANNEL", "SEND_MESSAGES", "EMBED_LINKS"],
  9. member: [],
  10. },
  11. aliases: ["l", "repeat"],
  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.trackRepeat) {
  25. player.setTrackRepeat(false)
  26. client.sendTime(message.channel, `Loop \`disabled\``);
  27. } else {
  28. player.setTrackRepeat(true)
  29. client.sendTime(message.channel, `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. const guild = client.guilds.cache.get(interaction.guild_id);
  42. const member = guild.members.cache.get(interaction.member.user.id);
  43. const voiceChannel = member.voice.channel;
  44. let player = await client.Manager.get(interaction.guild_id);
  45. if (!player) return client.sendTime(interaction, "❌ | **Nothing is playing right now...**");
  46. if (!member.voice.channel) return interaction.send("❌ | **You must be in a voice channel to use this command!**");
  47. if (guild.me.voice.channel && !guild.me.voice.channel.equals(voiceChannel)) return interaction.send(`❌ | You must be in ${guild.me.voice.channel} to use this command.`);
  48. if(player.trackRepeat){
  49. player.setTrackRepeat(false)
  50. client.sendTime(interaction, `Loop \`disabled\``);
  51. }else{
  52. player.setTrackRepeat(true)
  53. client.sendTime(interaction, `Loop \`enabled\``);
  54. }
  55. console.log(interaction.data)
  56. }
  57. }
  58. };