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:
@@ -65,14 +65,15 @@ func (p *HowAmIPlugin) OnMessage(ctx MessageContext) error {
|
||||
slog.Error("howami: send thinking", "err", err)
|
||||
}
|
||||
|
||||
profile := p.gatherProfile(target)
|
||||
go func() {
|
||||
profile := p.gatherProfile(target)
|
||||
|
||||
botName := os.Getenv("BOT_DISPLAY_NAME")
|
||||
if botName == "" {
|
||||
botName = "GogoBee"
|
||||
}
|
||||
prompt := fmt.Sprintf(
|
||||
`You are a witty, playful community bot called %s. Based on the following user profile data, write a fun, lighthearted "roast" of this user in 3-5 sentences. Be creative, funny, and reference specific stats. Keep it friendly — no truly mean insults.
|
||||
botName := os.Getenv("BOT_DISPLAY_NAME")
|
||||
if botName == "" {
|
||||
botName = "GogoBee"
|
||||
}
|
||||
prompt := fmt.Sprintf(
|
||||
`You are a witty, playful community bot called %s. Based on the following user profile data, write a fun, lighthearted "roast" of this user in 3-5 sentences. Be creative, funny, and reference specific stats. Keep it friendly — no truly mean insults.
|
||||
|
||||
User: %s
|
||||
|
||||
@@ -80,16 +81,20 @@ Profile data:
|
||||
%s
|
||||
|
||||
Write the roast now. Do not include any preamble or explanation, just the roast text.`,
|
||||
botName, string(target), profile,
|
||||
)
|
||||
botName, string(target), profile,
|
||||
)
|
||||
|
||||
response, err := callOllama(ollamaHost, ollamaModel, prompt)
|
||||
if err != nil {
|
||||
slog.Error("howami: ollama call", "err", err)
|
||||
return p.SendReply(ctx.RoomID, ctx.EventID, "Failed to generate profile. LLM might be offline.")
|
||||
}
|
||||
response, err := callOllama(ollamaHost, ollamaModel, prompt)
|
||||
if err != nil {
|
||||
slog.Error("howami: ollama call", "err", err)
|
||||
p.SendReply(ctx.RoomID, ctx.EventID, "Failed to generate profile. LLM might be offline.")
|
||||
return
|
||||
}
|
||||
|
||||
return p.SendReply(ctx.RoomID, ctx.EventID, response)
|
||||
p.SendReply(ctx.RoomID, ctx.EventID, response)
|
||||
}()
|
||||
|
||||
return nil
|
||||
}
|
||||
|
||||
func (p *HowAmIPlugin) gatherProfile(userID id.UserID) string {
|
||||
|
||||
Reference in New Issue
Block a user