added movesong and shuffle, will improve on them

This commit is contained in:
Emily 2020-04-22 01:05:33 +10:00
parent 5d2e02221b
commit c968292338
3 changed files with 80 additions and 6 deletions

View file

@ -10,11 +10,32 @@ exports.conf = {
}
exports.help = {
name: 'removesong',
name: 'shuffle',
category: 'Music',
description: 'Removes a song from the queue.',
usage: 'removesong [position]',
parameters: '[position] - The position of the song you want to remove'
description: 'Mixes up the songs in the queue',
usage: 'shuffle',
parameters: ''
}
const { getGuild } = require('../utils/music')
const { getGuild } = require('../utils/music')
module.exports.run = (client, message, args, level) => {
var queue = getGuild(message.guild.id).queue
if (queue.length < 3) {
return message.channel.send('Not enough songs are in the queue for this command to work!')
}
let j, x, i
for (i = queue.length - 1; i > 0; i--) {
if (i > 1) {
console.log(i)
j = Math.floor(Math.random() * (i + 1))
x = queue[i]
queue[i] = queue[j]
queue[j] = x
}
}
message.channel.send('Queue shuffled!')
}