10 Commits

Author SHA1 Message Date
ee1113280d fix(bot): clean up stale pairing state on /pair retry
When the operator misses a QR and retries /pair for the same label, the
previous pairing flow (Baileys session in memory + Telegram message id +
event listener) was still alive. Multiple listeners then raced to edit
the same QR message, surfacing as 400 'message is not modified' errors.

Fixes:
- Track one listener per account; new /pair tears down the previous one
- Stop the existing Baileys session and wipe its session dir so the new
  attempt starts from a clean slate
- Skip duplicate QR pushes (Baileys can re-emit identical QR strings)
- Fall back to a fresh photo if editMessageMedia fails for any reason
2026-05-09 16:32:23 +08:00
1e3173424a fix(bot): pin Baileys to latest WA Web version + handle smart quotes
Two pairing-flow fixes after live test:
- Connection Failure during pairing: Baileys announced a stale WhatsApp Web
  version that the server rejected before the QR was emitted. Pull the
  current version via fetchLatestBaileysVersion() at session start.
- Telegram mobile auto-converts straight quotes to curly quotes, so labels
  like /pair "test 1" arrived as “test 1” and the curly quotes were never
  stripped. Extend the quote-stripping regex on /pair, /unpair, /groups.
2026-05-09 16:28:01 +08:00
a77df43ae4 feat(bot): add /pair /unpair /accounts /groups commands 2026-05-09 16:23:22 +08:00
f8bd20184f feat(bot): add group sync upsert 2026-05-09 16:21:01 +08:00
c2ee793ae6 feat(bot): add session manager with state machine + reconnect 2026-05-09 16:20:20 +08:00
fc05a8b459 feat(bot): add Baileys session wrapper
Co-Authored-By: Claude Sonnet 4.6 <noreply@anthropic.com>
2026-05-09 16:18:11 +08:00
dd1eb711df feat(bot): add QR PNG renderer 2026-05-09 16:16:09 +08:00
20f24270d9 feat(bot): add telegram bot with whitelist, /start, /help, audit 2026-05-09 16:15:17 +08:00
3f3b090caa feat(bot): add audit log writer 2026-05-09 16:12:53 +08:00
4a790b9a60 feat(bot): scaffold env, logger, db, health, shutdown
Co-Authored-By: Claude Sonnet 4.6 <noreply@anthropic.com>
2026-05-09 16:10:37 +08:00