-
Notifications
You must be signed in to change notification settings - Fork 1
/
Copy pathvolume.js
28 lines (26 loc) · 1.39 KB
/
volume.js
1
2
3
4
5
6
7
8
9
10
11
12
13
14
15
16
17
18
19
20
21
22
23
24
25
26
27
28
const { MessageEmbed } = require("discord.js");
const sendError = require("../util/error");
module.exports = {
info: {
name: "volume",
description: "To change the server song queue volume",
usage: "[volume]",
aliases: ["v", "vol"],
},
run: async function (client, message, args) {
const channel = message.member.voice.channel;
if (!channel)return sendError("I'm sorry but you need to be in a voice channel to play music!", message.channel);
const serverQueue = message.client.queue.get(message.guild.id);
if (!serverQueue) return sendError("There is nothing playing in this server.", message.channel);
if (!args[0])return message.channel.send(`The current volume is: **${serverQueue.volume}**`);
if(isNaN(args[0])) return message.channel.send(':notes: Numbers only!').catch(err => console.log(err));
if(parseInt(args[0]) > 150 ||(args[0]) < 0) return sendError('You can\'t set the volume more than 150. or lower than 0',message.channel).catch(err => console.log(err));
serverQueue.volume = args[0];
serverQueue.connection.dispatcher.setVolumeLogarithmic(args[0] / 100);
let xd = new MessageEmbed()
.setDescription(`I set the volume to: **${args[0]/1}/100**`)
.setAuthor("Server Volume Manager", "https://raw.githubusercontent.com/SudhanPlayz/Discord-MusicBot/master/assets/Music.gif")
.setColor("BLUE")
return message.channel.send(xd);
},
};