Update queue.js

This commit is contained in:
Wizzard 2024-08-17 19:06:58 -04:00
parent cb9bf7d7a1
commit ca3b6bcdd4
1 changed files with 10 additions and 4 deletions

View File

@ -8,6 +8,8 @@ module.exports = {
const queue = getQueue(message.guild.id); const queue = getQueue(message.guild.id);
const currentTrack = getCurrentTrack(message.guild.id); const currentTrack = getCurrentTrack(message.guild.id);
const pageSize = 8;
const embed = new EmbedBuilder() const embed = new EmbedBuilder()
.setColor('#0099ff') .setColor('#0099ff')
.setTitle('Current Queue'); .setTitle('Current Queue');
@ -18,16 +20,16 @@ module.exports = {
: currentTrack.title; : currentTrack.title;
embed.addFields({ embed.addFields({
name: 'Currently playing', name: 'Currently playing',
value: `${currentTrackDisplay} \nRequested by: ${currentTrack.requester}`, value: `${currentTrackDisplay}\nRequested by: ${currentTrack.requester}`,
inline: false inline: false
}); });
} }
if (queue.length > 0) { if (queue.length > 0) {
const queueDisplay = queue.map((track, index) => { const queueDisplay = queue.slice(0, pageSize).map((track, index) => {
const trackDisplay = track.url const trackDisplay = track.url
? `**${index + 1}.** [${track.title}](${track.url}) \nRequested by: ${track.requester}` ? `**${index + 1}.** [${track.title}](${track.url})\nRequested by: ${track.requester}`
: `**${index + 1}.** ${track.title} \nRequested by: ${track.requester}`; : `**${index + 1}.** ${track.title}\nRequested by: ${track.requester}`;
return trackDisplay; return trackDisplay;
}).join('\n\n'); }).join('\n\n');
@ -36,6 +38,10 @@ module.exports = {
value: queueDisplay, value: queueDisplay,
inline: false inline: false
}); });
if (queue.length > pageSize) {
embed.setFooter({ text: `And ${queue.length - pageSize} more...` });
}
} else if (!currentTrack) { } else if (!currentTrack) {
embed.setDescription('The queue is empty!'); embed.setDescription('The queue is empty!');
} }