- ATK/DEF/Heal now accept K/M shorthand (500K, 1.4M, case-insensitive) via
a shared parser (@helpers/stat-value), used identically by the Submit
Score modal, /tg score set, and /tg-admin score-inject
- /tg-admin score-modal — officers can open the Submit Score modal on
behalf of any player; the modal's customId now carries the target
userKey so submission always resolves to the intended player rather
than whoever's Discord client is submitting it
- fix: /tg call now actually reveals the Submit Score button (was
recording the call but never opening submission)
- fix: /tg poll reload no longer resurrects Submit Score / Yes-No buttons
that had already been removed — poll state now tracks submission-open
and buttons-removed explicitly instead of re-deriving it from
locked/confirmed on every render
- fix: midnight cleanup now fully removes all poll buttons (not just
Submit Score) instead of leaving them disabled
- Sleep Check — players on a configured role get flagged (💤 shown on
their poll row) the moment they vote Yes; a scheduled per-slot job DMs
everyone currently flagged at a configurable time before TG (default
20 min). State changes and DM sending are intentionally decoupled —
flagging never itself sends a message. Officers can also flag/clear
manually via /tg-admin sleep-check set|clear
- data/updates/v0.9.2 and new v0.10 changelog entries for the above
- merged the two .claude reference docs into one, removed stale/fixed
items, documented the new systems and known deferred gaps
3.2 KiB
TG Bot — Merge & Deployment Checklist
Follow these steps IN ORDER every time we're ready to merge dev → prod. Never skip steps, never edit prod directly.
Step 1 — Commit on dev
cd /opt/docker/tg-bot-ts-dev
git add -A
git commit -m "<message>"
git push origin dev
Commit message conventions:
feature: short description— new player-facing featurefix: short description— bug fixhousekeeping: short description— internal/admin-only addition, refactor, maintenance- For multi-topic commits, use a body:
fix: unify score submission, fix TGScore type drift, fix playedBy semantics - Score.submit/score/set.ts/score-inject.ts now share one code path - TGScore consolidated to single canonical type - playedBy now correctly identifies the actual player on borrowed characters - Attendance.allSubmitted matches against playedBy (borrower) not just userKey
Step 2 — Merge to prod
cd /opt/docker/tg-bot-ts
git fetch origin
git merge origin/dev
docker compose up -d --build
docker compose restart
Step 3 — Run maintenance scripts (ALWAYS after merge)
python3 scripts/migrate-stats-shape.py /opt/docker/tg-bot-ts/data
python3 scripts/fix-class-keys.py /opt/docker/tg-bot-ts/data
These are safe to re-run (idempotent). The class-key script is especially important — see the Known Bug note below.
Step 4 — Verify prod is healthy
docker logs tg-bot-ts --tail 50 2>&1
# or via alias:
tg-prod-logs
Look for: no TypeScript compile errors, no unhandled exceptions on startup, "Bot ready." in the logs, poll state restored correctly if a poll was active.
Step 5 — Post changelog and announcements (if applicable)
/tg-admin updates post version:vX.X.X
/tg-admin announcement post id:XXX-announcement-id
Only post what's new since the last prod deploy — don't re-post already-posted versions.
Known Bug — Class object serialization (recurring, must run fix-class-keys.py every merge)
Files are still being written with the UNSERIALIZED CharacterClass object shape instead
of the plain ClassKey string. Example of the broken shape:
"characterClass": {
"key": "DM",
"name": "Dark Mage",
"shortName": "DM"
}
Expected shape (everywhere in wrank.json and tg-history/*.json):
"class": "DM"
This causes class emojis to silently disappear from Leaderboard/Result embeds.
scripts/fix-class-keys.py normalizes these on every run — run it after EVERY merge
until the systemic fix (a proper serializeCharacter/hydrateCharacter pair at every
read/write boundary) is implemented.
The systemic fix is tracked in REFERENCE.md under PENDING items.
Quick reference — shell aliases (both stacks, defined in ~/.bashrc)
tg-dev-logs # docker logs tg-bot-ts-dev --follow
tg-prod-logs # docker logs tg-bot-ts --follow
tg-dev-restart # docker compose restart (dev)
tg-prod-deploy # fetch + merge + build + restart (prod)
tg-dev-register # register slash commands on dev
tg-prod-register # register slash commands on prod
tg-dev-upload-emojis
tg-prod-upload-emojis
tg-dev-split-emojis