diff options
Diffstat (limited to 'src/commands/voice/volume.js')
| -rw-r--r-- | src/commands/voice/volume.js | 43 |
1 files changed, 43 insertions, 0 deletions
diff --git a/src/commands/voice/volume.js b/src/commands/voice/volume.js new file mode 100644 index 0000000..bd5f0b0 --- /dev/null +++ b/src/commands/voice/volume.js @@ -0,0 +1,43 @@ +const { Command } = require('discord.js-commando'); +const emoji = require('emoji-random'); + +module.exports = class VolumeVoice extends Command { + constructor(client) { + super(client, { + name: 'volume', + aliases: ['vol'], + 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 + } + ], + examples: [ + 's5n!volume 20', + 's5n!vol 50' + ] + }); + } + run(msg, { wantedVol }) { + var voiceChannel = msg.member.voice.channel; + if (!voiceChannel) return msg.reply('join a channel and try again ' + emoji.random()); + + if ( + typeof msg.guild.musicData.songDispatcher == 'undefined' || + msg.guild.musicData.songDispatcher == null + ) { + return msg.reply('there isn\'t a song playing right now lol ' + emoji.random()); + } + + const volume = wantedVol / 100; + msg.guild.musicData.volume = volume; + msg.guild.musicData.songDispatcher.setVolume(volume); + msg.reply(`volume is now: **${wantedVol}%** ` + emoji.random()); + } +};
\ No newline at end of file |