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/remove.cjs | |
| parent | fix join, v1.1.1 (diff) | |
| download | minecraftsoundtrackbot-test.tar.xz minecraftsoundtrackbot-test.zip | |
testtest
Diffstat (limited to 'commands/voice/remove.cjs')
| -rw-r--r-- | commands/voice/remove.cjs | 39 |
1 files changed, 39 insertions, 0 deletions
diff --git a/commands/voice/remove.cjs b/commands/voice/remove.cjs new file mode 100644 index 0000000..edcb948 --- /dev/null +++ b/commands/voice/remove.cjs @@ -0,0 +1,39 @@ +const { Command } = require('discord.js-commando'); +const emoji = require('emoji-random'); + +module.exports = class RemoveVoice extends Command { + constructor(client) { + super(client, { + name: 'remove', + group: 'voice', + memberName: 'remove', + description: 'Remove a certain song from the soundtrack queue.', + guildOnly: true, + args: [ + { + key: 'songNumber', + prompt: 'What song would you like the remove?', + type: 'integer' + } + ], + examples: ['msb!remove 2'] + }); + } + 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 voice 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.guild.musicData.queue.splice(songNumber - 1, 1); + return msg.say(`Removed song **#${songNumber}** from soundtrack queue. ` + emoji.random()); + } +};
\ No newline at end of file |