DZ-Musicbot/commands/queue.js

30 lines
957 B
JavaScript

const { getQueue, getCurrentTrack } = require('../utils/queueManager');
const { EmbedBuilder } = require('discord.js');
module.exports = {
name: 'queue',
execute(message) {
const queue = getQueue(message.guild.id);
const currentTrack = getCurrentTrack(message.guild.id);
const embed = new EmbedBuilder()
.setColor('#0099ff')
.setTitle('Current Queue');
if (currentTrack) {
embed.addFields({ name: 'Currently playing', value: `${currentTrack.title}`, inline: false });
}
if (queue.length > 0) {
embed.addFields({
name: 'Up next',
value: queue.map((track, index) => `${index + 1}. ${track.title}`).join('\n'),
inline: false
});
} else if (!currentTrack) {
embed.setDescription('The queue is empty!');
}
message.channel.send({ embeds: [embed] });
}
};