From 537f5dab07280842e6d88a17475c06bf476de798 Mon Sep 17 00:00:00 2001 From: baz Date: Fri, 16 Feb 2024 17:54:49 +0000 Subject: [PATCH] Hide users with no beat games from the leaderboard --- commands/100-games/leaderboard.js | 12 +++++++----- 1 file changed, 7 insertions(+), 5 deletions(-) diff --git a/commands/100-games/leaderboard.js b/commands/100-games/leaderboard.js index 160b066..eb9035f 100644 --- a/commands/100-games/leaderboard.js +++ b/commands/100-games/leaderboard.js @@ -16,15 +16,17 @@ module.exports = { for (let i = 0; i < leaderboard.length; i++) { - let newLine = String.prototype.concat('#', (i + 1), ' \t', leaderboard[i].username, ' - ', leaderboard[i].count, ' games'); + if (leaderboard[i].count > 0) { + let newLine = String.prototype.concat('#', (i + 1), ' \t', leaderboard[i].username, ' - ', leaderboard[i].count, ' games'); - if (i == 0) newLine = String.prototype.concat('**', newLine, '**'); + if (i == 0) newLine = String.prototype.concat('**', newLine, '**'); - if (leaderboard[i].username == interaction.user.username) newLine = String.prototype.concat('*', newLine, '*'); + if (leaderboard[i].username == interaction.user.username) newLine = String.prototype.concat('*', newLine, '*'); - newLine = String.prototype.concat('\n', newLine); + newLine = String.prototype.concat('\n', newLine); - desc = String.prototype.concat(desc, newLine); + desc = String.prototype.concat(desc, newLine); + } } const embed = new EmbedBuilder()