Update queue.js

This commit is contained in:
Wizzard 2024-09-08 12:46:39 -04:00
parent 56178c08cd
commit c4768e7fb4
1 changed files with 20 additions and 9 deletions

View File

@ -9,7 +9,8 @@ module.exports = {
const queue = getQueue(message.guild.id);
const currentTrack = getCurrentTrack(message.guild.id);
const pageSize = 8;
const pageSize = 10;
const maxLength = 1024;
const embed = new EmbedBuilder()
.setColor('#0099ff')
@ -27,21 +28,31 @@ module.exports = {
}
if (queue.length > 0) {
const queueDisplay = queue.slice(0, pageSize).map((track, index) => {
let queueDisplay = '';
let songCount = 0;
for (let i = 0; i < Math.min(queue.length, pageSize); i++) {
const track = queue[i];
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');
? `**${i + 1}.** [**${track.title}**](${track.url})\nRequested by: ${track.requester}`
: `**${i + 1}.** **${track.title}**\nRequested by: ${track.requester}`;
if ((queueDisplay + trackDisplay).length > maxLength) {
break;
}
queueDisplay += trackDisplay + '\n\n';
songCount++;
}
embed.addFields({
name: 'Up next',
value: queueDisplay,
value: queueDisplay.trim(),
inline: false
});
if (queue.length > pageSize) {
embed.setFooter({ text: `And ${queue.length - pageSize} more...` });
if (queue.length > songCount) {
embed.setFooter({ text: `And ${queue.length - songCount} more...` });
}
} else if (!currentTrack) {
embed.setDescription('The queue is empty!');