Skip to content

Commit

Permalink
feat(bot): show trophy for 1st place winner in inline button score
Browse files Browse the repository at this point in the history
  • Loading branch information
gabeklavans committed Jun 21, 2024
1 parent 4cce4f9 commit 8f7cf30
Showing 1 changed file with 5 additions and 1 deletion.
6 changes: 5 additions & 1 deletion src/server/routes.ts
Original file line number Diff line number Diff line change
Expand Up @@ -168,7 +168,11 @@ function updateInlineKeyboard(gameSession: GameSession) {
// only show top 8, everyone else needs to train harder
.slice(0, 8)
.forEach((player, idx) => {
inlineKeyboard.text(`${player.done ? idx + 1 : ".."}. ${player.name}`);
let inlineText = `${player.done ? idx + 1 : ".."}. ${player.name}`;
if (idx === 0 && Object.values(gameSession.players).filter((p) => p.score).length >= 2) {
inlineText += " 🏆";
}
inlineKeyboard.text(inlineText);
if (idx % 2 == 1) inlineKeyboard.row();
});

Expand Down

0 comments on commit 8f7cf30

Please sign in to comment.