1
0
mirror of https://github.com/musix-org/musix-oss synced 2024-11-15 01:20:19 +00:00
musix-oss/src/commands/remove.js

32 lines
1020 B
JavaScript
Raw Normal View History

2020-02-05 20:02:53 +00:00
module.exports = {
2020-04-19 17:00:16 +00:00
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, command) {
const queue = 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%",
queue.songs.length
);
if (pos > queue.songs.length) return msg.channel.send(message1);
message2 = client.messages.removed.replace(
"%SONG%",
queue.songs[pos].title
);
msg.channel.send(message2);
return queue.songs.splice(pos, 1);
2020-02-05 20:02:53 +00:00
}
2020-04-19 17:00:16 +00:00
},
2020-02-05 20:02:53 +00:00
};