Fixed leaderboard first name color.

This commit is contained in:
2022-10-23 21:53:59 +02:00
parent 11dd4f2c53
commit be4ee96847
2 changed files with 7 additions and 13 deletions

View File

@@ -3,10 +3,12 @@
const config = require('config');
const style = require('./style');
function getLeaders(points) {
return Object.entries(points).sort(([, scoreA], [, scoreB]) => scoreB - scoreA).map(([username, score], index) => {
function getLeaders(points, _user) {
return Object.entries(points).sort(([, scoreA], [, scoreB]) => scoreB - scoreA).map(([userKey, score], index) => {
const username = userKey.split(':')[1]; // process the points file
if (index === 0) {
return `${style.bold(`${config.usernamePrefix}${username}`)} with ${style.bold(`${score}`)} points`;
return `${style.bold(style.yellow(`${config.usernamePrefix}${username}`))} with ${style.bold(`${score}`)} points`;
}
return `${style.bold(style.cyan(`${config.usernamePrefix}${username}`))} with ${style.bold(`${score}`)} points`;