From 3869e91ed21b3292bb11a9eb0d07baec4354acf3 Mon Sep 17 00:00:00 2001 From: Santiago Forero Date: Thu, 16 Sep 2021 16:04:58 -0500 Subject: [PATCH] leaderboard now works when there's less than 5 people in the db --- commands/leaderboard.js | 5 +++-- 1 file changed, 3 insertions(+), 2 deletions(-) diff --git a/commands/leaderboard.js b/commands/leaderboard.js index 90976ab..93fa5d2 100644 --- a/commands/leaderboard.js +++ b/commands/leaderboard.js @@ -17,8 +17,9 @@ module.exports = { let text = "" for(let i = 0; i < 5; i++) { - if(data === undefined) break - text += `${i + 1}. ${data[i].ID} (${data[i].data} cm) ` + if(data[i] != undefined) { + text += `${i + 1}. ${data[i].ID} (${data[i].data} cm) ` + } } bot.say(event.target, 'Cactus Leaderboard: ' + text)