volume.js 2.7 KB

12345678910111213141516171819202122232425262728293031323334353637383940414243444546474849505152535455565758596061
  1. const { MessageEmbed } = require("discord.js");
  2. const { TrackUtils } = require("erela.js");
  3. module.exports = {
  4. name: "volume",
  5. description: "Changes the Volume",
  6. usage: "<volume>",
  7. permissions: {
  8. channel: ["VIEW_CHANNEL", "SEND_MESSAGES", "EMBED_LINKS"],
  9. member: [],
  10. },
  11. aliases: ["vol", "v"],
  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. if (!parseInt(args[0])) return message.channel.send("Please choose between 1 - 100");
  24. let vol = parseInt(args[0]);
  25. player.setVolume(vol);
  26. message.channel.send(`🔉 | Volume set to \`${player.volume}\``);
  27. },
  28. SlashCommand: {
  29. options: [
  30. {
  31. name: "number",
  32. value: "number 1 - 100",
  33. type: 4,
  34. required: true,
  35. description: "What do you want to change the volume to?",
  36. },
  37. ],
  38. /**
  39. *
  40. * @param {import("../structures/DiscordMusicBot")} client
  41. * @param {import("discord.js").Message} message
  42. * @param {string[]} args
  43. * @param {*} param3
  44. */
  45. run: async (client, interaction, args, { GuildDB }) => {
  46. const guild = client.guilds.cache.get(interaction.guild_id);
  47. const member = guild.members.cache.get(interaction.member.user.id);
  48. if (!member.voice.channel) return client.sendTime(interaction, "❌ | You must be in a voice channel to use this command.");
  49. 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.`);
  50. let player = await client.Manager.get(interaction.guild_id);
  51. if (!player) return client.sendTime(interaction, "❌ | **Nothing is playing right now...**");
  52. if (!args.length) return client.sendTime(interaction, `🔉 | Current volume \`${player.volume}\`.`);
  53. let vol = parseInt(args[0].value);
  54. if (!vol || vol < 1 || vol > 100) return client.sendTime(interaction, `Please choose between \`1 - 100\``);
  55. player.setVolume(vol);
  56. client.sendTime(interaction, `🔉 | Volume set to \`${player.volume}\``);
  57. },
  58. },
  59. };