1
0
mirror of https://github.com/musix-org/musix-oss synced 2024-11-12 23:20:17 +00:00
musix-oss/commands/remove.js
2020-03-13 16:20:23 +02:00

26 lines
1.1 KiB
JavaScript

module.exports = {
name: 'remove',
alias: 'rm',
usage: '<song pos>',
description: 'Remove a song from the queue',
onlyDev: false,
permission: 'MANAGE_MESSAGES',
category: 'music',
execute(msg, args, client, Discord, prefix, command) {
const serverQueue = client.queue.get(msg.guild.id);
if (client.funcs.check(client, msg, command)) {
if (!args[1]) return msg.channel.send(client.messages.provideASong);
const pos = parseInt(args[1]);
if (isNaN(pos)) return msg.channel.send(client.messages.validNumber);
if (pos < 1) return msg.channel.send(client.messages.noSongs);
let message1;
let message2;
message1 = client.messages.queueLength.replace("%LENGTH%", serverQueue.songs.length);
if (pos > serverQueue.songs.length) return msg.channel.send(message1);
message2 = client.messages.removed.replace("%SONG%", serverQueue.songs[pos].title);
msg.channel.send(message2);
return serverQueue.songs.splice(pos, 1);
}
}
};