Add total pages to command leaderboard

This commit is contained in:
Dragon Fire
2020-05-31 22:25:16 -04:00
parent e6e2afe98f
commit 25473003c0
4 changed files with 7 additions and 7 deletions
+4 -4
View File
@@ -23,11 +23,11 @@ module.exports = class CommandLeaderboardCommand extends Command {
}
run(msg, { page }) {
const lb = this.makeLeaderboard(page);
if (!lb.length) return msg.say(`Page ${page} does not exist (yet).`);
const totalPages = Math.ceil(this.client.registry.commands.size / 10);
if (page > totalPages) return msg.say(`Page ${page} does not exist (yet).`);
return msg.say(stripIndents`
__**Command Usage Leaderboard (Page ${page}):**__
${lb.join('\n')}
__**Command Usage Leaderboard (Page ${page}/${totalPages}):**__
${this.makeLeaderboard(page).join('\n')}
`);
}