Queue embed
This commit is contained in:
parent
15bc4fff2f
commit
dc5d2fd19b
|
@ -1,5 +1,5 @@
|
||||||
const { getQueue, getCurrentTrack } = require('../utils/queueManager');
|
const { getQueue, getCurrentTrack } = require('../utils/queueManager');
|
||||||
const path = require('path');
|
const { EmbedBuilder } = require('discord.js');
|
||||||
|
|
||||||
module.exports = {
|
module.exports = {
|
||||||
name: 'queue',
|
name: 'queue',
|
||||||
|
@ -7,13 +7,24 @@ module.exports = {
|
||||||
const queue = getQueue(message.guild.id);
|
const queue = getQueue(message.guild.id);
|
||||||
const currentTrack = getCurrentTrack(message.guild.id);
|
const currentTrack = getCurrentTrack(message.guild.id);
|
||||||
|
|
||||||
if (!currentTrack && queue.length === 0) {
|
const embed = new EmbedBuilder()
|
||||||
return message.channel.send('The queue is empty!');
|
.setColor('#0099ff')
|
||||||
|
.setTitle('Current Queue');
|
||||||
|
|
||||||
|
if (currentTrack) {
|
||||||
|
embed.addFields({ name: 'Currently playing', value: `${currentTrack}`, inline: false });
|
||||||
}
|
}
|
||||||
|
|
||||||
let queueString = currentTrack ? `Currently playing: ${path.basename(currentTrack)}\n\n` : '';
|
if (queue.length > 0) {
|
||||||
queueString += queue.map((track, index) => `${index + 1}. ${path.basename(track)}`).join('\n');
|
embed.addFields({
|
||||||
|
name: 'Up next',
|
||||||
|
value: queue.map((track, index) => `${index + 1}. ${track}`).join('\n'),
|
||||||
|
inline: false
|
||||||
|
});
|
||||||
|
} else if (!currentTrack) {
|
||||||
|
embed.setDescription('The queue is empty!');
|
||||||
|
}
|
||||||
|
|
||||||
message.channel.send(`Current queue:\n${queueString}`);
|
message.channel.send({ embeds: [embed] });
|
||||||
}
|
}
|
||||||
};
|
};
|
Loading…
Reference in New Issue