Queue embed

This commit is contained in:
Wizzard 2024-08-17 12:10:35 -04:00
parent 15bc4fff2f
commit dc5d2fd19b
1 changed files with 17 additions and 6 deletions

View File

@ -1,5 +1,5 @@
const { getQueue, getCurrentTrack } = require('../utils/queueManager');
const path = require('path');
const { EmbedBuilder } = require('discord.js');
module.exports = {
name: 'queue',
@ -7,13 +7,24 @@ module.exports = {
const queue = getQueue(message.guild.id);
const currentTrack = getCurrentTrack(message.guild.id);
if (!currentTrack && queue.length === 0) {
return message.channel.send('The queue is empty!');
const embed = new EmbedBuilder()
.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` : '';
queueString += queue.map((track, index) => `${index + 1}. ${path.basename(track)}`).join('\n');
if (queue.length > 0) {
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] });
}
};