2024-08-17 11:46:19 -04:00
|
|
|
const { getQueue, getCurrentTrack } = require('../utils/queueManager');
|
2024-08-17 12:10:35 -04:00
|
|
|
const { EmbedBuilder } = require('discord.js');
|
2024-08-17 11:11:10 -04:00
|
|
|
|
|
|
|
module.exports = {
|
|
|
|
name: 'queue',
|
2024-08-17 15:24:09 -04:00
|
|
|
description: 'Show the current songs in queue',
|
2024-08-17 11:11:10 -04:00
|
|
|
execute(message) {
|
|
|
|
const queue = getQueue(message.guild.id);
|
2024-08-17 11:46:19 -04:00
|
|
|
const currentTrack = getCurrentTrack(message.guild.id);
|
|
|
|
|
2024-08-17 12:10:35 -04:00
|
|
|
const embed = new EmbedBuilder()
|
|
|
|
.setColor('#0099ff')
|
|
|
|
.setTitle('Current Queue');
|
|
|
|
|
|
|
|
if (currentTrack) {
|
2024-08-17 17:56:35 -04:00
|
|
|
const currentTrackDisplay = currentTrack.url
|
|
|
|
? `[${currentTrack.title}](${currentTrack.url})`
|
|
|
|
: currentTrack.title;
|
2024-08-17 18:16:33 -04:00
|
|
|
embed.addFields({
|
|
|
|
name: 'Currently playing',
|
|
|
|
value: `${currentTrackDisplay} \nRequested by: ${currentTrack.requester}`,
|
|
|
|
inline: false
|
|
|
|
});
|
2024-08-17 11:11:10 -04:00
|
|
|
}
|
2024-08-17 11:46:19 -04:00
|
|
|
|
2024-08-17 12:10:35 -04:00
|
|
|
if (queue.length > 0) {
|
2024-08-17 17:56:35 -04:00
|
|
|
const queueDisplay = queue.map((track, index) => {
|
|
|
|
const trackDisplay = track.url
|
2024-08-17 18:16:33 -04:00
|
|
|
? `**${index + 1}.** [${track.title}](${track.url}) \nRequested by: ${track.requester}`
|
|
|
|
: `**${index + 1}.** ${track.title} \nRequested by: ${track.requester}`;
|
2024-08-17 18:05:36 -04:00
|
|
|
return trackDisplay;
|
2024-08-17 18:16:33 -04:00
|
|
|
}).join('\n\n');
|
2024-08-17 17:56:35 -04:00
|
|
|
|
2024-08-17 12:10:35 -04:00
|
|
|
embed.addFields({
|
|
|
|
name: 'Up next',
|
2024-08-17 17:56:35 -04:00
|
|
|
value: queueDisplay,
|
2024-08-17 12:10:35 -04:00
|
|
|
inline: false
|
|
|
|
});
|
|
|
|
} else if (!currentTrack) {
|
|
|
|
embed.setDescription('The queue is empty!');
|
|
|
|
}
|
2024-08-17 11:46:19 -04:00
|
|
|
|
2024-08-17 12:10:35 -04:00
|
|
|
message.channel.send({ embeds: [embed] });
|
2024-08-17 11:11:10 -04:00
|
|
|
}
|
2024-08-17 18:34:28 -04:00
|
|
|
};
|