45 lines
1.6 KiB
JavaScript
45 lines
1.6 KiB
JavaScript
const { getQueue, getCurrentTrack } = require('../utils/queueManager');
|
|
const { EmbedBuilder } = require('discord.js');
|
|
|
|
module.exports = {
|
|
name: 'queue',
|
|
description: 'Show the current songs in 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) {
|
|
const currentTrackDisplay = currentTrack.url
|
|
? `[${currentTrack.title}](${currentTrack.url})`
|
|
: currentTrack.title;
|
|
embed.addFields({
|
|
name: 'Currently playing',
|
|
value: `${currentTrackDisplay} \nRequested by: ${currentTrack.requester}`,
|
|
inline: false
|
|
});
|
|
}
|
|
|
|
if (queue.length > 0) {
|
|
const queueDisplay = queue.map((track, index) => {
|
|
const trackDisplay = track.url
|
|
? `**${index + 1}.** [${track.title}](${track.url}) \nRequested by: ${track.requester}`
|
|
: `**${index + 1}.** ${track.title} \nRequested by: ${track.requester}`;
|
|
return trackDisplay;
|
|
}).join('\n\n');
|
|
|
|
embed.addFields({
|
|
name: 'Up next',
|
|
value: queueDisplay,
|
|
inline: false
|
|
});
|
|
} else if (!currentTrack) {
|
|
embed.setDescription('The queue is empty!');
|
|
}
|
|
|
|
message.channel.send({ embeds: [embed] });
|
|
}
|
|
}; |