Skip to content
This repository has been archived by the owner on Sep 3, 2024. It is now read-only.

Commit

Permalink
fix: Show total amount of tracks in queue footer besides pages
Browse files Browse the repository at this point in the history
  • Loading branch information
mariusbegby committed Jul 18, 2023
1 parent 5606531 commit 3f15094
Showing 1 changed file with 6 additions and 4 deletions.
10 changes: 6 additions & 4 deletions src/commands/player/queue.js
Original file line number Diff line number Diff line change
Expand Up @@ -44,13 +44,14 @@ module.exports = {
.setDescription(`**${embedOptions.icons.queue} Tracks in queue**\n${queueString}`)
.setColor(embedOptions.colors.info)
.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) {
return await interaction.editReply({
Expand Down Expand Up @@ -98,6 +99,7 @@ module.exports = {
queue.repeatMode === 3 ? embedOptions.icons.autoplay : embedOptions.icons.loop
} Looping**\nLoop mode is set to ${loopModeUserString}. You can change it with **\`/loop\`**.\n\n`
}`;


if (!currentTrack) {
return await interaction.editReply({
Expand All @@ -111,7 +113,7 @@ module.exports = {
`${repeatModeString}` + `**${embedOptions.icons.queue} Tracks in queue**\n${queueString}`
)
.setFooter({
text: `Page ${pageIndex + 1} of ${totalPages}`
text: `Page ${pageIndex + 1} of ${totalPages} (${queueLength} tracks)`
})
.setColor(embedOptions.colors.info)
]
Expand Down Expand Up @@ -148,7 +150,7 @@ module.exports = {
)
.setThumbnail(queue.currentTrack.thumbnail)
.setFooter({
text: `Page ${pageIndex + 1} of ${totalPages}`
text: `Page ${pageIndex + 1} of ${totalPages} (${queueLength} tracks)`
})
.setColor(embedOptions.colors.info)
]
Expand Down

0 comments on commit 3f15094

Please # to comment.