mirror of
https://github.com/prosolis/gogobee.git
synced 2026-07-16 00:52:40 +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:
@@ -1,7 +1,6 @@
|
||||
package plugin
|
||||
|
||||
import (
|
||||
"context"
|
||||
"fmt"
|
||||
"math/rand/v2"
|
||||
"strings"
|
||||
@@ -143,7 +142,7 @@ func (p *FlipPlugin) handleLoseboard(ctx MessageContext) error {
|
||||
var sb strings.Builder
|
||||
sb.WriteString("🐝 **GogoBee's Trophy Wall**\n\n")
|
||||
for i, uid := range order {
|
||||
name := p.flipDisplayName(id.UserID(uid))
|
||||
name := p.DisplayName(id.UserID(uid))
|
||||
stats := users[uid]
|
||||
var parts []string
|
||||
for game, count := range stats.breakdown {
|
||||
@@ -163,8 +162,7 @@ func (p *FlipPlugin) handleLoseboard(ctx MessageContext) error {
|
||||
// recordBotDefeat increments the bot defeat counter for a user in a specific game.
|
||||
// This is a package-level function so all game plugins can call it.
|
||||
func recordBotDefeat(userID id.UserID, game string) {
|
||||
d := db.Get()
|
||||
_, _ = d.Exec(
|
||||
db.Exec("flip: record bot defeat",
|
||||
`INSERT INTO bot_defeats (user_id, game, losses)
|
||||
VALUES (?, ?, 1)
|
||||
ON CONFLICT(user_id, game) DO UPDATE SET
|
||||
@@ -173,13 +171,7 @@ func recordBotDefeat(userID id.UserID, game string) {
|
||||
)
|
||||
}
|
||||
|
||||
func (p *FlipPlugin) flipDisplayName(userID id.UserID) string {
|
||||
resp, err := p.Client.GetDisplayName(context.Background(), userID)
|
||||
if err != nil || resp.DisplayName == "" {
|
||||
return string(userID)
|
||||
}
|
||||
return resp.DisplayName
|
||||
}
|
||||
|
||||
|
||||
// redirectToGamesRoom returns the room ID for games-restricted redirect.
|
||||
func redirectToGamesRoom(sender id.UserID) string {
|
||||
|
||||
Reference in New Issue
Block a user