сам код
updates.hear(/(?:Топ|top)/i, (context) => {
let _users = [];
for (let key in users) {
if (users[key] .permission === 0 && !users[key] .ban){
_users.push({
id: key,
balance: users[key] .balance,
});
}
}
return context.send(
"Топ-10 по балансу:\n" +
_users
.sort((a, b) =>b.balance - a.balance)
.slice(0, 10)
.map((x, i) => `${++i}. @id${x. id} - ${x.balance}`)
.join("\n")
);
});