naar-music-bot
Version:
Simple JavaScript Music Discord Bot Powerd By: NAAR Studio.
53 lines (52 loc) • 2.37 kB
JavaScript
const { MessageEmbed } = require("discord.js");
module.exports = {
name: "volume",
aliases: ["vol"],
cooldown: 5,
description: `Change the song valume!.`,
run: async(client, message, args) => {
if (client.volume_command == true) {
if (!message.guild) return;
message.react("✅");
const queue = message.client.queue.get(message.guild.id);
if (!queue) return message.channel.send(
new MessageEmbed()
.setTitle(`Thare is nothing in the music queue!`)
.setColor("RED")).catch(err => {
throw new TypeError(err)
});
const volinfoembed = new MessageEmbed()
.setColor("#c219d8")
.setTitle(`🔊 Volume is: \`${queue.volume}%\``)
if (!args[0]) return message.channel.send(volinfoembed).catch(err => {
throw new TypeError(err)
});
if (isNaN(args[0])) return message.channel.send(
new MessageEmbed()
.setTitle("That's not a Number between **0 & 100**")
.setColor("RED")).catch(err => {
throw new TypeError(err)
});
if (parseInt(args[0]) < 0 || parseInt(args[0]) > 100)
return message.channel.send(
new MessageEmbed()
.setTitle("That's not a Number between **0 & 100**")
.setColor("RED")).catch(err => {
throw new TypeError(err)
});
queue.volume = args[0];
queue.connection.dispatcher.setVolumeLogarithmic(args[0] / 100);
const volinfosetembed = new MessageEmbed()
.setColor("#c219d8")
.setTitle(`🔊 Volume changed to: \`${args[0]}%\`!`)
return queue.textChannel.send(volinfosetembed).catch(err => {
throw new TypeError(err)
});
} else if (client.help_command == false) {
message.channel.send(
new MessageEmbed()
.setTitle(`\`${module.exports.name}\` Has Been Disabled From The Music System`)
)
} else throw new TypeError(`❌ | "${module.exports.name}_command" value must be true or false`)
}
};