mirror of
https://github.com/prosolis/gogobee.git
synced 2026-07-16 17:02:42 +00:00
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:
@@ -76,7 +76,12 @@ func (p *StocksPlugin) OnReaction(_ ReactionContext) error { return nil }
|
||||
|
||||
func (p *StocksPlugin) OnMessage(ctx MessageContext) error {
|
||||
if p.IsCommand(ctx.Body, "stock") {
|
||||
return p.handleStock(ctx)
|
||||
go func() {
|
||||
if err := p.handleStock(ctx); err != nil {
|
||||
slog.Error("stocks: handler error", "err", err)
|
||||
}
|
||||
}()
|
||||
return nil
|
||||
}
|
||||
if p.IsCommand(ctx.Body, "stockwatch") {
|
||||
return p.handleStockwatch(ctx)
|
||||
@@ -152,14 +157,11 @@ func (p *StocksPlugin) fetchStock(ticker string) (*stockCacheEntry, error) {
|
||||
|
||||
// Update cache
|
||||
data, _ := json.Marshal(entry)
|
||||
_, err = d.Exec(
|
||||
db.Exec("stocks: cache write",
|
||||
`INSERT INTO stocks_cache (ticker, data, cached_at) VALUES (?, ?, ?)
|
||||
ON CONFLICT(ticker) DO UPDATE SET data = ?, cached_at = ?`,
|
||||
ticker, string(data), time.Now().Unix(), string(data), time.Now().Unix(),
|
||||
)
|
||||
if err != nil {
|
||||
slog.Error("stocks: cache write", "err", err)
|
||||
}
|
||||
|
||||
return entry, nil
|
||||
}
|
||||
|
||||
Reference in New Issue
Block a user