leaderboard now works when there's less than 5 people in the db

This commit is contained in:
Santiago Forero 2021-09-16 16:04:58 -05:00
parent dabe2a1ae3
commit 3869e91ed2
1 changed files with 3 additions and 2 deletions

View File

@ -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)