diff options
Diffstat (limited to 'commands/voice/volume.js')
| -rw-r--r-- | commands/voice/volume.js | 38 |
1 files changed, 38 insertions, 0 deletions
diff --git a/commands/voice/volume.js b/commands/voice/volume.js new file mode 100644 index 0000000..e29486d --- /dev/null +++ b/commands/voice/volume.js @@ -0,0 +1,38 @@ +const { Command } = require('discord.js-commando'); + +module.exports = class VolumeVoice extends Command { + constructor(client) { + super(client, { + name: 'volume', + aliases: ['vol', 'v'], + group: 'voice', + memberName: 'volume', + description: 'changes volume of audio if playing', + guildOnly: true, + args: [ + { + key: 'wantedVol', + prompt: 'what volume u want, from 1 to 200', + type: 'integer', + validate: wantedVol => wantedVol >= 1 && wantedVol <= 200 + } + ] + }); + } + run(msg, { wantedVol }) { + var voiceChannel = msg.member.voice.channel; + if (!voiceChannel) return msg.reply('join a channel and try again'); + + if ( + typeof msg.guild.musicData.songDispatcher == 'undefined' || + msg.guild.musicData.songDispatcher == null + ) { + return msg.reply('there isn\'t a song playing right now lol'); + } + + const volume = wantedVol / 100; + msg.guild.musicData.volume = volume; + msg.guild.musicData.songDispatcher.setVolume(volume); + msg.reply(`volume is now: ${wantedVol}%`); + } +};
\ No newline at end of file |