align /getgamers and stats-message tables, unify stats body into one code block
All checks were successful
CI/CD Pipeline / build-and-deploy (push) Successful in 31s

- /getgamers: column-aligned monospace table (username, ratings, period).
- Per-mode stats (rating/wins/losses/draws): column-aligned block, dropped
  the meaningless multi-game average accuracy row.
- format_stats_response/format_period_notification now wrap the whole
  message in a single markdown code block instead of alternating
  plain-text headers and separately-fenced tables.
- Rating row gets an emoji prefix to match the other three rows, so
  Telegram's monospace rendering keeps all values in the same column.
This commit is contained in:
vrubelroman 2026-07-03 13:20:50 +00:00
parent 2a7385290e
commit f154d3d7c3
3 changed files with 113 additions and 76 deletions

View file

@ -784,16 +784,8 @@ class LichessBot:
})
logger.info(f"Added gamer {gamer['username']} with N/A ratings due to error")
# Create text message with stats
text_lines = []
for gamer in gamers_data:
text_lines.append(
f"<b>{gamer['username']}</b> "
f"{gamer['bullet']} 🔥 {gamer['blitz']} 🐇 {gamer['rapid']}{gamer['period']}"
)
logger.info(f"getgamers: prepared {len(gamers_data)} gamers for display")
# Check if we have any gamers to display
if not gamers_data:
logger.warning(f"getgamers: No gamers data prepared, but gamers list was not empty. This should not happen.")
@ -803,8 +795,9 @@ class LichessBot:
pass
await update.message.reply_text(t('no_gamers', lang))
return
gamers_text = t('select_active_gamer', lang) + "\n".join(text_lines)
gamers_table = StatsFormatter.format_gamers_table(gamers_data)
gamers_text = t('select_active_gamer', lang) + "<pre>" + gamers_table + "</pre>"
logger.info(f"getgamers: message length: {len(gamers_text)} characters")