From ca3b6bcdd4746fd6e701d61200ccc86dd621a385 Mon Sep 17 00:00:00 2001 From: Wizzard Date: Sat, 17 Aug 2024 19:06:58 -0400 Subject: [PATCH] Update queue.js --- commands/queue.js | 14 ++++++++++---- 1 file changed, 10 insertions(+), 4 deletions(-) diff --git a/commands/queue.js b/commands/queue.js index 9f80308..a33c33e 100644 --- a/commands/queue.js +++ b/commands/queue.js @@ -8,6 +8,8 @@ module.exports = { const queue = getQueue(message.guild.id); const currentTrack = getCurrentTrack(message.guild.id); + const pageSize = 8; + const embed = new EmbedBuilder() .setColor('#0099ff') .setTitle('Current Queue'); @@ -18,16 +20,16 @@ module.exports = { : currentTrack.title; embed.addFields({ name: 'Currently playing', - value: `${currentTrackDisplay} \nRequested by: ${currentTrack.requester}`, + value: `${currentTrackDisplay}\nRequested by: ${currentTrack.requester}`, inline: false }); } if (queue.length > 0) { - const queueDisplay = queue.map((track, index) => { + const queueDisplay = queue.slice(0, pageSize).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}`; + ? `**${index + 1}.** [${track.title}](${track.url})\nRequested by: ${track.requester}` + : `**${index + 1}.** ${track.title}\nRequested by: ${track.requester}`; return trackDisplay; }).join('\n\n'); @@ -36,6 +38,10 @@ module.exports = { value: queueDisplay, inline: false }); + + if (queue.length > pageSize) { + embed.setFooter({ text: `And ${queue.length - pageSize} more...` }); + } } else if (!currentTrack) { embed.setDescription('The queue is empty!'); }