pause.js 2.6 KB

123456789101112131415161718192021222324252627282930313233343536373839404142434445464748495051525354
  1. const { MessageEmbed } = require("discord.js");
  2. const { TrackUtils } = require("erela.js");
  3. module.exports = {
  4. name: "pause",
  5. description: "Pauses the music",
  6. usage: "",
  7. permissions: {
  8. channel: ["VIEW_CHANNEL", "SEND_MESSAGES", "EMBED_LINKS"],
  9. member: [],
  10. },
  11. aliases: [],
  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.paused) return client.sendTime(message.channel, "❌ | **Music is already paused!**");
  25. player.pause(true);
  26. let embed = new MessageEmbed().setAuthor(`Paused!`, client.config.IconURL).setColor("RANDOM").setDescription(`Type \`${GuildDB.prefix}resume\` to play!`);
  27. await message.channel.send(embed);
  28. await message.react("✅");
  29. },
  30. SlashCommand: {
  31. /**
  32. *
  33. * @param {import("../structures/DiscordMusicBot")} client
  34. * @param {import("discord.js").Message} message
  35. * @param {string[]} args
  36. * @param {*} param3
  37. */
  38. run: async (client, interaction, args, { GuildDB }) => {
  39. const guild = client.guilds.cache.get(interaction.guild_id);
  40. const member = guild.members.cache.get(interaction.member.user.id);
  41. if (!member.voice.channel) return client.sendTime(interaction, "❌ | **You must be in a voice channel to use this command.**");
  42. 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.**`);
  43. let player = await client.Manager.get(interaction.guild_id);
  44. if (!player) return client.sendTime(interaction, "❌ | **Nothing is playing right now...**");
  45. if (player.paused) return client.sendTime(interaction, "Music is already paused!");
  46. player.pause(true);
  47. client.sendTime(interaction, "**⏸ Paused!**");
  48. },
  49. },
  50. };