feat(bots): anonConfess + shitpostLeaderboard built-in bots

- ConfessBot: polls for /confess messages, deletes original, reposts anonymous
- LeaderboardBot: daily top-10 message count recap from DB
- BotFunc extended with *sql.DB param for DB-reading bots
- Both types registered in runner + BotManager UI
This commit is contained in:
2026-07-15 19:46:09 -04:00
parent 49ea7c4e3b
commit f6322fb779
6 changed files with 183 additions and 4 deletions
+3 -3
View File
@@ -11,8 +11,8 @@ import (
)
// BotFunc is the signature for a built-in bot type's run function.
// It blocks until ctx is cancelled. Use send to post messages.
type BotFunc func(ctx context.Context, config json.RawMessage, send SendMessageFunc)
// It blocks until ctx is cancelled. Use send to post messages, db to read.
type BotFunc func(ctx context.Context, db *sql.DB, config json.RawMessage, send SendMessageFunc)
// SendMessageFunc posts a message to a channel as this bot.
type SendMessageFunc func(channelID, content string)
@@ -91,7 +91,7 @@ func (r *Runner) Start(botID, botType string, config json.RawMessage) {
r.logger.Error("bot panic", "bot_id", botID, "type", botType, "panic", rec)
}
}()
fn(ctx, config, send)
fn(ctx, r.db, config, send)
r.logger.Info("bot stopped", "bot_id", botID, "type", botType)
}()
}