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

@@ -72,15 +72,20 @@ func renderKeyboard(states map[rune]LetterResult) string {
}
// renderWordleStartAnnouncement renders the puzzle start message.
func renderWordleStartAnnouncement(puzzleNumber, wordLength int) string {
return fmt.Sprintf(
"🟩 **Daily Wordle #%d**\nA new %d-letter puzzle is ready! Work together — 6 guesses shared.\n\nGuess with: `!wordle <word>`",
func renderWordleStartAnnouncement(puzzleNumber, wordLength int, hint string) string {
base := fmt.Sprintf(
"🟩 **Daily Wordle #%d**\nA new %d-letter puzzle is ready! Work together — 6 guesses shared.",
puzzleNumber, wordLength,
)
if hint != "" {
base += fmt.Sprintf("\n🎮 **Hint:** %s", hint)
}
base += "\n\nGuess with: `!wordle <word>`"
return base
}
// renderSolvedAnnouncement renders the solved puzzle message.
func renderSolvedAnnouncement(puzzle *WordlePuzzle, definition string) string {
func renderSolvedAnnouncement(puzzle *WordlePuzzle, definition string, payouts []WordlePayout) string {
var sb strings.Builder
// Find the solver.
@@ -107,18 +112,29 @@ func renderSolvedAnnouncement(puzzle *WordlePuzzle, definition string) string {
sb.WriteString("\n")
}
// Contributors.
sb.WriteString("\n🏆 Today's contributors:\n")
contributors := wordleContributors(puzzle)
for _, c := range contributors {
line := fmt.Sprintf(" %s — %d guess", c.name, c.guesses)
if c.guesses != 1 {
line += "es"
// Contributors with payouts.
if len(payouts) > 0 {
sb.WriteString("\n💰 **Payouts:**\n")
for _, pay := range payouts {
bonus := ""
if pay.Solver {
bonus = " 🏆 (solver bonus!)"
}
sb.WriteString(fmt.Sprintf(" **%s**: +€%d%s\n", pay.Name, pay.Amount, bonus))
}
if c.solved {
line += " 🏆"
} else {
sb.WriteString("\n🏆 Today's contributors:\n")
contributors := wordleContributors(puzzle)
for _, c := range contributors {
line := fmt.Sprintf(" %s — %d guess", c.name, c.guesses)
if c.guesses != 1 {
line += "es"
}
if c.solved {
line += " 🏆"
}
sb.WriteString(line + "\n")
}
sb.WriteString(line + "\n")
}
return sb.String()