Commit graph

12 commits

Author SHA1 Message Date
vrubelroman
635ebf6c2e onboarding: «where is the username» answered with text and an example, pictures removed
Co-Authored-By: Claude Fable 5.1 <noreply@anthropic.com>
2026-10-21 14:29:25 +00:00
vrubelroman
5422b0a73f admin /status: distinct players with a report per day
Co-Authored-By: Claude Fable 5.1 <noreply@anthropic.com>
2026-10-21 13:33:25 +00:00
vrubelroman
58bf8b7381 drop the 'player quiet for 30 days' prompt (owner decision)
All checks were successful
CI/CD Pipeline / build-and-deploy (push) Successful in 29s
The bot sends nothing on its own initiative except reports and the closed /
not-found account notices. Removes the periodic check, the sl: callbacks,
the silent_prompt_at column migration, the i18n keys and their tests.

Co-Authored-By: Claude Fable 5.1 <noreply@anthropic.com>
2026-10-21 11:58:51 +00:00
vrubelroman
37d8d8a69e report: wins tail shortened to N/M
Co-Authored-By: Claude Fable 5.1 <noreply@anthropic.com>
2026-10-21 11:54:18 +00:00
vrubelroman
df6b582376 iteration 1: report with game table, /getgamers state screen, silent-30-days prompt, /today as one message, stats port bound to localhost
- periodic report rebuilt in HTML: title with games count, mode lines, one <pre>
  table (± · colour · accuracy · opponent rating · opponent accuracy), 10-row cap,
  span note after catch-up; stats service returns tracked_rating_diff per game
- /getgamers shows player state from the DB (played today / N days quiet /
  closed / not found, report period) without Lichess calls; ratings on a button
- "player silent 30 days — keep?" prompt with keep/delete buttons, repeat 90 days
- /today, /yesterday, /week: one message edited into the result, nav buttons
- /year localised; active-gamer leftovers and N/A removed; one period wording
- docker-compose.prod.yml: stats port 8002 bound to 127.0.0.1
- product review docs: user journeys, concepts, Mini App feasibility, proposal

Co-Authored-By: Claude Fable 5.1 <noreply@anthropic.com>
2026-10-21 11:26:20 +00:00
vrubelroman
533c0a7694 onboarding phase 1: one-screen /start, any text is a player name, URL/@ normalisation, next-step texts, /addtoken trap closed
Analysis: docs/analysis/onboarding_funnel.md (56% of users never add a player;
drop happens on the first screen; non-ru/en users convert at 25%).
Design: docs/design/onboarding.md.

- /start: one message. New user: promise + "send a Lichess username, e.g.
  DrNykterstein" with [❓ Где взять имя] / [🇬🇧 English] (language switch edits
  the message in place). Returning user: their players + /today /addgamer /help.
- /addgamer asks for the name directly (the two-button menu from 2025-12-03 is gone).
- Any non-command text in a private chat is a player-name attempt: no awaiting
  flag, PicklePersistence removed. onboarding.normalise_username accepts
  lichess.org URLs, @name, quotes, "add Name"; chess.com and non-name text get
  their own hints; nothing is sent to Lichess for them.
- Every reply ends with the next step (success: hourly report is on, /today,
  send another name). One no_players empty state for /today, /week, /getgamers,
  /delgamer, /setperiod, /profile, /year.
- /help: 18 lines in three groups; /year and /lang aliases; command menu set
  from code for en (default) and ru at startup (set_my_commands).
- /addtoken trap: non-lip_ text gets a hint instead of "invalid token"; any
  other command inside the conversation ends it and runs; /cancel outside a
  conversation answers "nothing to cancel".
- All echoed input html-escaped. Terminology unified: игрок / имя на Lichess /
  отчёт (player / Lichess username / report).
- events: user_start screen=, addgamer_input kind= normalised=, addgamer_result
  format|chesscom, lang_set via=, addtoken_result not_a_token; text in_flow= gone.
- i18n: 18 dead keys removed, 21 added; docs (README, USER_GUIDE, about,
  CURRENT_STATE, CHANGELOG Unreleased) updated; 107 bot tests (was 61).

Co-Authored-By: Claude Fable 5.1 <noreply@anthropic.com>
2026-10-21 07:36:31 +00:00
vrubelroman
6351e18795 admin bot: /status redesigned around health, growth and activity; raw counters moved to /counters
- /status: verdict line (✅/⚠️, UTC time), 🩺 health (errors today/yesterday,
  Lichess 429 per 24 h from /health, age of the last player-status refresh,
  closed/not-found players, users who blocked the bot in 7 days), 📈 growth
  table (users/gamers/subscriptions: total, +today, +yesterday, +7 days,
  users without gamers), ⚡ activity today vs yesterday (commands, active
  users, notifications, Lichess requests). Flags: errors >= 10, any 429,
  status older than 30 min, no SUMMARY for yesterday, journal missing.
  Blocks fail independently (only a DB failure breaks the whole message).
- /counters: all raw command counters sorted by total + last SUMMARY as is.
- Database.get_admin_overview replaces get_admin_stats.
- events.summarize_days (one pass over events.log.1 + events.log, extra
  keys active_users/blocked/status_refresh_failed/cmd_by_name/lines),
  last_summary(); last_summary_line reads the rotated backup too.
- LichessAPI.get_service_health(timeout).
- Designer spec in docs/design/admin_status.md; README, CURRENT_STATE,
  CHANGELOG (Unreleased) updated; 25 new tests (61 bot tests total).

Co-Authored-By: Claude Fable 5.1 <noreply@anthropic.com>
2026-10-21 06:16:53 +00:00
vrubelroman
a7571f13c1 v1.5.1: not-found players paused, tests in repo + CI, log-based daily summary, docs pruned
All checks were successful
CI/CD Pipeline / build-and-deploy (push) Successful in 16s
- players absent from two consecutive bulk answers (deleted/renamed on Lichess) are paused
  like closed accounts with their own notice; ❓ mark; stats service answers 404 instead
  of "0 games" for unknown users
- /getgamers table stays unmarked, a legend line under it lists closed / not-found players
- daily SUMMARY is computed from events.log (survives restarts); lichess_429 comes from the
  stats service /health, which now exposes lichess_429_24h / lichess_429_total
- admin /status reads its numbers through Database.get_admin_stats
- tests/: 36 bot + 15 service unittest cases, run_tests.sh runs them inside the real images,
  CI runs them after the build and before pushing/deploying
- docs: USER_GUIDE/about/API_DOCUMENTATION rewritten for the current code, ARCHITECTURE.md and
  two sub-READMEs removed, 7 obsolete helper scripts removed, CURRENT_STATE updated
- .claude/agents/designer.md: Telegram-aware designer role

Co-Authored-By: Claude Fable 5.1 <noreply@anthropic.com>
2026-10-21 02:48:00 +00:00
vrubelroman
99b1275834 v1.5.0: startup status-refresh retries, /today skips dormant players, unknown-command hint, /cancel fix
All checks were successful
CI/CD Pipeline / build-and-deploy (push) Successful in 16s
- player status: initial bulk refresh retries 4x5s (bot and stats service start in the
  same second on prod, the first attempt failed with connection reset); admin is
  notified after 3 consecutive failed refreshes
- /today, /yesterday, /week: players whose bulk status shows they were not online since
  the period start (or whose account is closed) are skipped without any Lichess call;
  stats service paces user/activity at 8.5s (Lichess allows 15 per 2 min per IP), so a
  user with 16+ tracked players no longer hits 429 mid-command
- unknown /commands in private chats get the usual hint and a cmd name=unknown event
- /addtoken -> /cancel used to crash (sync lambda awaited by PTB 20); now an async handler
- version 1.5.0, CHANGELOG entry for everything since 1.1.0 that shipped today
- docs: CURRENT_STATE.md rewritten for 30aaa34, README brought in line with the code
  (port 8002, module list, commands, .env vars, DB tables, events.log section)

Co-Authored-By: Claude Fable 5.1 <noreply@anthropic.com>
2026-10-20 23:21:53 +00:00
vrubelroman
7178b80854 split bot.py into periodic/notifications/onboarding modules, drop redundant request queue
Behaviour-preserving refactor:
- periodic.py: PeriodicMonitor (periodic_check & friends, moved verbatim with comments)
- notifications.py: one AdminNotifier for both processes (was 4 copies of the same
  direct-API code), with a 10 s HTTP timeout and the TTS announcer
- onboarding.py: link_player(), the add-player flow shared by /addgamer and /addtoken
- bot.py 2040 -> 1372 lines; no inline sqlite3 left (Database.gamer_exists/get_counts)
- request_queue.py removed: periodic checks call the local stats service under a
  10-slot semaphore; the only real Lichess limiter is SharedTokenGate in the service.
  Bot-side RateLimiter kept only for direct lichess.org calls.
- /addtoken "already tracked" check is now case-insensitive like /addgamer
- docs/CURRENT_STATE.md: system map as of 6355cd9 (analyst)
- .claude/agents: analyst / developer / tester definitions

Co-Authored-By: Claude Fable 5.1 <noreply@anthropic.com>
2026-10-20 21:46:48 +00:00
vrubelroman
75e62b57a1 remove admin web panel (LichessWebView) from the project
All checks were successful
CI/CD Pipeline / build-and-deploy (push) Successful in 43s
Unused component that also carried several security issues (default
admin credentials, hardcoded Flask secret key, debug mode, plaintext
passwords). Cleaned up compose files, CI/CD pipeline, and docs
accordingly; also dropped the stale IS_PROD config docs in favor of
the current .env-based setup.

Co-Authored-By: Claude Sonnet 5 <noreply@anthropic.com>
2026-07-02 18:32:06 +00:00
vrubelroman
e8ced9bca7 Добавлена документация и скрипты для работы с БД
- Удалены лишние .gitignore из подпапок (теперь один общий в корне)
- Добавлен import_db.sh для импорта базы данных
- Создана документация: docs/ARCHITECTURE.md для разработчиков
- Создана документация: docs/USER_GUIDE.md для пользователей
- Обновлен .gitignore для исключения временных файлов
2025-10-28 21:38:10 +03:00