Add forex plugin, stability fixes, and async HTTP dispatch

- Add forex plugin (Frankfurter v2 API) with rate lookups, analysis,
  DM-based alerts, and daily cron poll. Backfills 1 year of history
  on startup for moving averages and buy signal scoring.

- Fix bot hang caused by SQLite lock contention in reminder polling:
  rows cursor was held open while writing to the same DB. Collect
  results first, close cursor, then process. Same fix in milkcarton.

- Add sync retry loop so the bot reconnects after network drops
  instead of silently exiting. StopSync() for clean Ctrl+C shutdown.

- Add panic recovery to all dispatch, syncer, and cron paths.

- Make all HTTP-calling plugin commands async (goroutines) so a slow
  or dead external API cannot block the message dispatch pipeline.
  Affects: lookup, stocks, forex, anime, movies, concerts, gaming,
  retro, wotd, urls, howami.

- Extract DisplayName to Base, add db.Exec helper, convert silent
  error discards across the codebase.

- Fix UNO mercy-kill bug (eliminated bot continues playing), adventure
  DM nag spam, stats column mismatch, per-call regex/replacer allocs.

- Update README: forex commands, Finance section, 47 plugins.

Co-Authored-By: Claude Opus 4.6 <noreply@anthropic.com>
This commit is contained in:
prosolis
2026-03-26 09:22:02 -07:00
parent c7c1b76589
commit 9c6ded13fa
68 changed files with 5784 additions and 724 deletions

View File

@@ -59,32 +59,24 @@ func (p *StreaksPlugin) OnMessage(ctx MessageContext) error {
}
func (p *StreaksPlugin) trackDailyActivity(ctx MessageContext) {
d := db.Get()
today := time.Now().UTC().Format("2006-01-02")
_, err := d.Exec(
db.Exec("streaks: track daily activity",
`INSERT INTO daily_activity (user_id, date, message_count) VALUES (?, ?, 1)
ON CONFLICT(user_id, date) DO UPDATE SET message_count = message_count + 1`,
string(ctx.Sender), today,
)
if err != nil {
slog.Error("streaks: track daily activity", "err", err)
}
}
func (p *StreaksPlugin) trackFirstPoster(ctx MessageContext) {
d := db.Get()
today := time.Now().UTC().Format("2006-01-02")
now := time.Now().UTC().Unix()
// INSERT OR IGNORE — only the first poster for this room+date wins
_, err := d.Exec(
db.Exec("streaks: track first poster",
`INSERT OR IGNORE INTO daily_first (room_id, date, user_id, timestamp) VALUES (?, ?, ?, ?)`,
string(ctx.RoomID), today, string(ctx.Sender), now,
)
if err != nil {
slog.Error("streaks: track first poster", "err", err)
}
}
func (p *StreaksPlugin) handleStreak(ctx MessageContext) error {