diff options
| author | 8cy <[email protected]> | 2020-04-13 05:32:35 -0700 |
|---|---|---|
| committer | 8cy <[email protected]> | 2020-04-13 05:32:35 -0700 |
| commit | 9dff52f7d047c905326bc2f476ede5463e00f2a0 (patch) | |
| tree | 1fec8563b3b72fde9b2ab7ad9e56a97398798685 /commands/voice/shuffle.js | |
| parent | typescript (diff) | |
| download | s5nical-9dff52f7d047c905326bc2f476ede5463e00f2a0.tar.xz s5nical-9dff52f7d047c905326bc2f476ede5463e00f2a0.zip | |
typescript final
Diffstat (limited to 'commands/voice/shuffle.js')
| -rw-r--r-- | commands/voice/shuffle.js | 51 |
1 files changed, 0 insertions, 51 deletions
diff --git a/commands/voice/shuffle.js b/commands/voice/shuffle.js deleted file mode 100644 index 3771f16..0000000 --- a/commands/voice/shuffle.js +++ /dev/null @@ -1,51 +0,0 @@ -const { Command } = require('discord.js-commando'); -const { MessageEmbed } = require('discord.js'); -const emoji = require('emoji-random'); - -module.exports = class ShuffleVoice extends Command { - constructor(client) { - super(client, { - name: 'shuffle', - group: 'voice', - memberName: 'shuffle', - description: 'shuffle the queue', - guildOnly: true, - examples: ['s5n!shuffle'] - }); - } - run(msg) { - var voiceChannel = msg.member.voice.channel; - if (!voiceChannel) return msg.reply('join channel and try again k ' + emoji.random()); - - if ( - typeof msg.guild.musicData.songDispatcher == 'undefined' || - msg.guild.musicData.songDispatcher == null - ) { - return msg.reply('there is no song playing right now ' + emoji.random()); - } - - if (msg.guild.musicData.queue.length < 1) - return msg.say('There are no songs in queue ' + emoji.random()); - - shuffleQueue(msg.guild.musicData.queue); - - const titleArray = []; - msg.guild.musicData.queue.map(obj => { - titleArray.push(obj.title); - }); - var queueEmbed = new MessageEmbed() - .setColor(0xF97DAE) - .setTitle('new music q ' + emoji.random()); - for (let i = 0; i < titleArray.length; i++) { - queueEmbed.addField(`${i + 1}:`, `${titleArray[i]}`); - } - return msg.say(queueEmbed); - } -}; - -function shuffleQueue(queue) { - for (let i = queue.length - 1; i > 0; i--) { - const j = Math.floor(Math.random() * (i + 1)); - [queue[i], queue[j]] = [queue[j], queue[i]]; - } -}
\ No newline at end of file |