fix: Show total amount of tracks in queue footer besides pages

This commit is contained in:
Marius Begby committed 2023-07-18 20:26:14 +02:00
1 parent 56065317e7
commit 3f15094cf8
1 file changed
+6 -4
+6 -4
View File
@@ -44,13 +44,14 @@ module.exports = {
.setDescription(`**${embedOptions.icons.queue} Tracks in queue**\n${queueString}`) .setDescription(`**${embedOptions.icons.queue} Tracks in queue**\n${queueString}`)
.setColor(embedOptions.colors.info) .setColor(embedOptions.colors.info)
.setFooter({ .setFooter({
text: 'Page 1 of 1' text: 'Page 1 of 1 (0 tracks)'
}) })
] ]
}); });
} }
const totalPages = Math.ceil(queue.tracks.data.length / 10) || 1; const queueLength = queue.tracks.data.length;
const totalPages = Math.ceil(queueLength / 10) || 1;
if (pageIndex > totalPages - 1) { if (pageIndex > totalPages - 1) {
return await interaction.editReply({ return await interaction.editReply({
@@ -98,6 +99,7 @@ module.exports = {
queue.repeatMode === 3 ? embedOptions.icons.autoplay : embedOptions.icons.loop queue.repeatMode === 3 ? embedOptions.icons.autoplay : embedOptions.icons.loop
} Looping**\nLoop mode is set to ${loopModeUserString}. You can change it with **\`/loop\`**.\n\n` } Looping**\nLoop mode is set to ${loopModeUserString}. You can change it with **\`/loop\`**.\n\n`
}`; }`;
if (!currentTrack) { if (!currentTrack) {
return await interaction.editReply({ return await interaction.editReply({
@@ -111,7 +113,7 @@ module.exports = {
`${repeatModeString}` + `**${embedOptions.icons.queue} Tracks in queue**\n${queueString}` `${repeatModeString}` + `**${embedOptions.icons.queue} Tracks in queue**\n${queueString}`
) )
.setFooter({ .setFooter({
text: `Page ${pageIndex + 1} of ${totalPages}` text: `Page ${pageIndex + 1} of ${totalPages} (${queueLength} tracks)`
}) })
.setColor(embedOptions.colors.info) .setColor(embedOptions.colors.info)
] ]
@@ -148,7 +150,7 @@ module.exports = {
) )
.setThumbnail(queue.currentTrack.thumbnail) .setThumbnail(queue.currentTrack.thumbnail)
.setFooter({ .setFooter({
text: `Page ${pageIndex + 1} of ${totalPages}` text: `Page ${pageIndex + 1} of ${totalPages} (${queueLength} tracks)`
}) })
.setColor(embedOptions.colors.info) .setColor(embedOptions.colors.info)
] ]