From 9953af40c0da98a59fedec8cc174b92e08f84624 Mon Sep 17 00:00:00 2001 From: ender Date: Sun, 5 May 2024 23:50:46 +0200 Subject: [PATCH] fix polerank --- src/plugins/pole.ts | 38 ++++++++++++++++++-------------------- 1 file changed, 18 insertions(+), 20 deletions(-) diff --git a/src/plugins/pole.ts b/src/plugins/pole.ts index 05fb0f9..15dc36d 100644 --- a/src/plugins/pole.ts +++ b/src/plugins/pole.ts @@ -165,28 +165,26 @@ export class PolePlugin extends PluginBase { }); text = `${this.strings.ranking}:`; const rank = this.sortRanking(ranking, 'points'); - rank.map(async (user) => { - text += `\n • ${await getFullName(this.bot, user.uid, false)}: ${user.points} ${this.strings.points}`; - }); + for (const user of rank) { + const name = await getFullName(this.bot, user.uid, false); + text += `\n - ${name}: ${user.points} ${this.strings.points}`; + } - await Promise.all( - types.map(async (type) => { - let section = `\n\n${capitalize(this.strings[type + 's'])}:`; - let empty = true; - const rank = this.sortRanking(ranking, type); - await Promise.all( - rank.map(async (user) => { - if (user[type]) { - empty = false; - section += `\n • ${await getFullName(this.bot, user.uid, false)}: ${user[type]} ${this.strings[type + 's']}`; - } - }), - ); - if (!empty) { - text += section; + for (const type of types) { + let section = `\n\n${capitalize(this.strings[type + 's'])}:`; + let empty = true; + const rank = this.sortRanking(ranking, type); + for (const user of rank) { + if (user[type]) { + empty = false; + const name = await getFullName(this.bot, user.uid, false); + section += `\n - ${name}: ${user[type]} ${this.strings[type + 's']}`; } - }), - ); + } + if (!empty) { + text += section; + } + } } else { this.bot.replyMessage(msg, this.bot.errors.noResults); }