forked from embee/woomy
volume
This commit is contained in:
parent
8b16fba69a
commit
cfbce016b9
2 changed files with 40 additions and 0 deletions
32
commands/volume.js
Normal file
32
commands/volume.js
Normal file
|
@ -0,0 +1,32 @@
|
|||
exports.conf = {
|
||||
enabled: true,
|
||||
guildOnly: true,
|
||||
aliases: [],
|
||||
permLevel: 'User',
|
||||
requiredPerms: ['vol'],
|
||||
cooldown: 2000
|
||||
}
|
||||
|
||||
exports.help = {
|
||||
name: 'volume',
|
||||
category: 'Music',
|
||||
description: 'Sets volume of currently playing music. (100% = 25% of the actual volume)',
|
||||
usage: 'volume [volume]',
|
||||
params: '[volume] - Target volume from 0-100%'
|
||||
}
|
||||
|
||||
exports.run = async (client, message, args, level, data) => {
|
||||
let vol = args[0];
|
||||
|
||||
if(vol) {
|
||||
vol = Number(vol);
|
||||
|
||||
vol = vol / 100 * 0.25;
|
||||
|
||||
if(vol <= 1) {
|
||||
client.music.setVolume(message.guild, vol);
|
||||
|
||||
message.reply('set volume to ' + vol * 100 + '%');
|
||||
};
|
||||
};
|
||||
};
|
|
@ -131,4 +131,12 @@ module.exports = client => {
|
|||
return message.member.reply('failed to find the video!');
|
||||
};
|
||||
};
|
||||
|
||||
client.music.setVolume = function(guild, target) {
|
||||
let g = client.music.getGuild(guild.id);
|
||||
|
||||
if(g.dispatcher) {
|
||||
g.dispatcher.setVolume(target);
|
||||
};
|
||||
};
|
||||
}
|
||||
|
|
Loading…
Reference in a new issue