41 lines
1.4 KiB
JavaScript
41 lines
1.4 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, inline: false });
|
|
}
|
|
|
|
if (queue.length > 0) {
|
|
const queueDisplay = queue.map((track, index) => {
|
|
const trackDisplay = track.url
|
|
? `**${index + 1}.** [${track.title}](${track.url})`
|
|
: `**${index + 1}.** ${track.title}`;
|
|
return trackDisplay;
|
|
}).join('\n');
|
|
|
|
embed.addFields({
|
|
name: 'Up next',
|
|
value: queueDisplay,
|
|
inline: false
|
|
});
|
|
} else if (!currentTrack) {
|
|
embed.setDescription('The queue is empty!');
|
|
}
|
|
|
|
message.channel.send({ embeds: [embed] });
|
|
}
|
|
}; |