add leaderboard announcement

This commit is contained in:
biglyderv 2024-11-25 14:14:21 -05:00
parent 0a9fd2faf9
commit d810d66f50
3 changed files with 75 additions and 18 deletions

View file

@ -19,7 +19,8 @@ app.use('/js', express.static('./common'));
app.use(express.static('./static'));
app.get('/leaderboard', async function (ws, req) {
req.send(JSON.stringify(await db.all('SELECT * FROM stats ORDER BY ko DESC LIMIT 100')));
let scores = game.scores || [];
req.send(scores.map((x,i) => `#${i+1}: ${x[0]} [${x[1]}]`).join('\n'));
})
app.ws('/', function (ws, req) {