-
Notifications
You must be signed in to change notification settings - Fork 0
/
remove.js
48 lines (46 loc) · 1.35 KB
/
remove.js
1
2
3
4
5
6
7
8
9
10
11
12
13
14
15
16
17
18
19
20
21
22
23
24
25
26
27
28
29
30
31
32
33
34
35
36
37
38
39
40
41
42
43
44
45
46
47
48
const { MessageEmbed } = require('discord.js');
module.exports = {
name: "remove",
description: "Remove song from the queue",
async execute(message, args) {
if (!args.length) {
let removeErrorEmbed = new MessageEmbed()
.setTitle("Remove")
.setDescription("Usage: /remove <Queue Number>")
.setColor("#d32f2f")
return message.channel.send(removeErrorEmbed).then((msg) => {
setTimeout(() => {
if (msg.deletable) {
msg.delete();
}
}, 10000);
}).catch(console.error);
}
const serverQueue = message.client.queue.get(message.guild.id);
if (!serverQueue) {
let removeErrorEmbed = new MessageEmbed()
.setTitle("Remove")
.setDescription("There is nothing on queue right now.")
.setColor("#d32f2f")
return message.channel.send(removeErrorEmbed).then((msg) => {
setTimeout(() => {
if (msg.deletable) {
msg.delete();
}
}, 10000);
}).catch(console.error);
}
const song = serverQueue.songs.splice(args[0] - 1, 1);
let removeEmbed = new MessageEmbed()
.setTitle("Remove")
.setDescription(`A song named **${song[0].title}** has been removed from the queue by ${message.author}`)
.setColor("#d32f2f")
serverQueue.textChannel.send(removeEmbed).then((msg) => {
setTimeout(() => {
if (msg.deletable) {
msg.delete();
}
}, 10000);
}).catch(console.error);
}
};