diff options
| author | 8cy <[email protected]> | 2020-04-13 03:54:31 -0700 |
|---|---|---|
| committer | 8cy <[email protected]> | 2020-04-13 03:54:31 -0700 |
| commit | 3733f7575faba8a06cc65c8eaf3612f80f46a44b (patch) | |
| tree | a9ecd915e5749b960efbae5dd32307b9f998428c /commands/voice/volume.cjs | |
| parent | fix join, v1.1.1 (diff) | |
| download | minecraftsoundtrackbot-test.tar.xz minecraftsoundtrackbot-test.zip | |
testtest
Diffstat (limited to 'commands/voice/volume.cjs')
| -rw-r--r-- | commands/voice/volume.cjs | 44 |
1 files changed, 44 insertions, 0 deletions
diff --git a/commands/voice/volume.cjs b/commands/voice/volume.cjs new file mode 100644 index 0000000..0a59a68 --- /dev/null +++ b/commands/voice/volume.cjs @@ -0,0 +1,44 @@ +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', 'v'], + group: 'voice', + memberName: 'volume', + description: 'Changes the volume of playback.', + guildOnly: true, + args: [ + { + key: 'wantedVol', + prompt: 'What would you like the volume to be? (1 - 200)', + type: 'integer', + validate: wantedVol => wantedVol >= 1 && wantedVol <= 200 + } + ], + examples: [ + 'msb!volume 20', + 'msb!vol 50', + 'msb!v 70' + ] + }); + } + 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('The soundtrack isn\'t playing right now. ' + 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 |