aboutsummaryrefslogtreecommitdiff
path: root/commands/voice/skipto.cjs
diff options
context:
space:
mode:
author8cy <[email protected]>2020-04-13 03:54:31 -0700
committer8cy <[email protected]>2020-04-13 03:54:31 -0700
commit3733f7575faba8a06cc65c8eaf3612f80f46a44b (patch)
treea9ecd915e5749b960efbae5dd32307b9f998428c /commands/voice/skipto.cjs
parentfix join, v1.1.1 (diff)
downloadminecraftsoundtrackbot-test.tar.xz
minecraftsoundtrackbot-test.zip
testtest
Diffstat (limited to 'commands/voice/skipto.cjs')
-rw-r--r--commands/voice/skipto.cjs41
1 files changed, 41 insertions, 0 deletions
diff --git a/commands/voice/skipto.cjs b/commands/voice/skipto.cjs
new file mode 100644
index 0000000..aa27add
--- /dev/null
+++ b/commands/voice/skipto.cjs
@@ -0,0 +1,41 @@
+const { Command } = require('discord.js-commando');
+const emoji = require('emoji-random');
+
+module.exports = class SkipToVoice extends Command {
+ constructor(client) {
+ super(client, {
+ name: 'skipto',
+ group: 'voice',
+ memberName: 'skipto',
+ description: 'Skip to a certain song in the soundtrack queue.',
+ guildOnly: true,
+ args: [{
+ key: 'songNumber',
+ prompt: 'What song would you like the skip to?',
+ type: 'integer'
+ }],
+ examples: ['msb!skipto 5']
+ });
+ }
+ run(msg, { songNumber }) {
+ if (songNumber < 1 && songNumber >= msg.guild.musicData.queue.length) {
+ return msg.reply('Please enter a valid song number' + emoji.random());
+ }
+ 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());
+ }
+
+ if (msg.guild.musicData.queue < 1)
+ return msg.reply('This is the only song in the soundtrack queue. ' + emoji.random());
+
+ msg.guild.musicData.queue.splice(0, songNumber - 1);
+ msg.guild.musicData.songDispatcher.end();
+ return;
+ }
+}; \ No newline at end of file