mirror of
https://github.com/prosolis/gogobee.git
synced 2026-07-15 08:32:41 +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:
@@ -240,36 +240,44 @@ func (p *MilkCartonPlugin) getMissingMembers() []missingMember {
|
||||
}
|
||||
defer rows.Close()
|
||||
|
||||
var result []missingMember
|
||||
type candidate struct {
|
||||
userID, lastDate string
|
||||
}
|
||||
var candidates []candidate
|
||||
for rows.Next() {
|
||||
var userID, lastDate string
|
||||
if err := rows.Scan(&userID, &lastDate); err != nil {
|
||||
var c candidate
|
||||
if err := rows.Scan(&c.userID, &c.lastDate); err != nil {
|
||||
continue
|
||||
}
|
||||
candidates = append(candidates, c)
|
||||
}
|
||||
rows.Close()
|
||||
|
||||
var result []missingMember
|
||||
for _, c := range candidates {
|
||||
// Skip excluded users
|
||||
if p.excludeUsers[userID] {
|
||||
if p.excludeUsers[c.userID] {
|
||||
continue
|
||||
}
|
||||
|
||||
// Skip bots (our own user ID)
|
||||
if id.UserID(userID) == p.Client.UserID {
|
||||
if id.UserID(c.userID) == p.Client.UserID {
|
||||
continue
|
||||
}
|
||||
|
||||
// Skip users with active away/afk status
|
||||
var awayStatus int
|
||||
_ = d.QueryRow(`SELECT 1 FROM presence WHERE user_id = ? AND status IN ('away', 'afk')`, userID).Scan(&awayStatus)
|
||||
_ = d.QueryRow(`SELECT 1 FROM presence WHERE user_id = ? AND status IN ('away', 'afk')`, c.userID).Scan(&awayStatus)
|
||||
if awayStatus == 1 {
|
||||
continue
|
||||
}
|
||||
|
||||
lastTime, err := time.Parse("2006-01-02", lastDate)
|
||||
lastTime, err := time.Parse("2006-01-02", c.lastDate)
|
||||
if err != nil {
|
||||
continue
|
||||
}
|
||||
days := int(now.Sub(lastTime).Hours() / 24)
|
||||
result = append(result, missingMember{userID: userID, daysSince: days})
|
||||
result = append(result, missingMember{userID: c.userID, daysSince: days})
|
||||
}
|
||||
return result
|
||||
}
|
||||
|
||||
Reference in New Issue
Block a user