diff options
| author | 8cy <[email protected]> | 2020-04-12 05:54:08 -0700 |
|---|---|---|
| committer | 8cy <[email protected]> | 2020-04-12 05:54:08 -0700 |
| commit | 5b6a874eab03c7e97794fc334ed2f06caf90b094 (patch) | |
| tree | 4593cfbb2c5e5f4212fb718e426df43c8abfd523 /commands/voice/pause.js | |
| parent | Initial commit (diff) | |
| download | minecraftsoundtrackbot-5b6a874eab03c7e97794fc334ed2f06caf90b094.tar.xz minecraftsoundtrackbot-5b6a874eab03c7e97794fc334ed2f06caf90b094.zip | |
The Beginning, v1.0.0
Diffstat (limited to 'commands/voice/pause.js')
| -rw-r--r-- | commands/voice/pause.js | 30 |
1 files changed, 30 insertions, 0 deletions
diff --git a/commands/voice/pause.js b/commands/voice/pause.js new file mode 100644 index 0000000..20d4254 --- /dev/null +++ b/commands/voice/pause.js @@ -0,0 +1,30 @@ +const { Command } = require('discord.js-commando'); +const emoji = require('emoji-random'); + +module.exports = class PauseVoice extends Command { + constructor(client) { + super(client, { + name: 'pause', + group: 'voice', + memberName: 'pause', + description: 'Pauses soundtrack playback if playing.', + guildOnly: true, + examples: ['msb!pause'] + }); + } + run(msg) { + 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()); + } + + msg.say('Soundtrack paused :pause_button:'); + + msg.guild.musicData.songDispatcher.pause(); + } +};
\ No newline at end of file |