mirror of
https://github.com/prosolis/gogobee.git
synced 2026-07-16 08:52:42 +00:00
Add !adv alias, hospital insurance billing, wordle/UNO earnings tracking, streak death protection
- Add !adv shorthand for !adventure commands and DM replies - Hospital bill now shows insurance deduction and amount due - Refactor hospital nudge from per-goroutine sleep to shared ticker - Dead players' streaks are frozen; grace period on revival day - Track wordle earnings in wordle_stats, show in !stats and superstats - Show UNO net earnings and trivia accuracy % in superstats - Disable sentiment/profanity emoji reactions (classification still logs) - Add URL_PREVIEW_IGNORE_USERS env var to skip bot users - Add DISABLE_WOTD_POST env var, remove unused wotd.Prefetch() - README updates for all of the above Co-Authored-By: Claude Opus 4.6 <noreply@anthropic.com>
This commit is contained in:
@@ -28,6 +28,7 @@ type AdventurePlugin struct {
|
||||
arenaDeadlines sync.Map // userID string -> time.Time (auto-cashout deadline)
|
||||
arenaPending sync.Map // userID string -> int (pending tier number awaiting confirmation)
|
||||
shopSessions sync.Map // userID string -> *advShopSession
|
||||
hospitalNudges sync.Map // userID string -> time.Time (when to send nudge)
|
||||
morningHour int
|
||||
summaryHour int
|
||||
}
|
||||
@@ -120,6 +121,7 @@ func (p *AdventurePlugin) Init() error {
|
||||
go p.arenaAutoCashoutTicker()
|
||||
go p.rivalChallengeTicker()
|
||||
go p.robbieTicker()
|
||||
go p.hospitalNudgeTicker()
|
||||
|
||||
// Auto-cashout any arena runs left in 'awaiting' from a prior restart
|
||||
p.arenaCleanupStaleRuns()
|
||||
@@ -171,7 +173,7 @@ func (p *AdventurePlugin) OnMessage(ctx MessageContext) error {
|
||||
}
|
||||
|
||||
// 3. Command dispatch
|
||||
if !p.IsCommand(ctx.Body, "adventure") {
|
||||
if !p.IsCommand(ctx.Body, "adventure") && !p.IsCommand(ctx.Body, "adv") {
|
||||
return nil
|
||||
}
|
||||
|
||||
@@ -180,6 +182,9 @@ func (p *AdventurePlugin) OnMessage(ctx MessageContext) error {
|
||||
|
||||
func (p *AdventurePlugin) dispatchCommand(ctx MessageContext) error {
|
||||
args := strings.TrimSpace(p.GetArgs(ctx.Body, "adventure"))
|
||||
if args == "" && p.IsCommand(ctx.Body, "adv") {
|
||||
args = strings.TrimSpace(p.GetArgs(ctx.Body, "adv"))
|
||||
}
|
||||
lower := strings.ToLower(args)
|
||||
|
||||
switch {
|
||||
@@ -491,12 +496,13 @@ func (p *AdventurePlugin) handleDMReply(ctx MessageContext) error {
|
||||
body := strings.TrimSpace(ctx.Body)
|
||||
|
||||
// Skip if it looks like a command for another plugin
|
||||
if strings.HasPrefix(body, "!") && !strings.HasPrefix(strings.ToLower(body), "!adventure") {
|
||||
lower := strings.ToLower(body)
|
||||
if strings.HasPrefix(body, "!") && !strings.HasPrefix(lower, "!adventure") && !strings.HasPrefix(lower, "!adv") {
|
||||
return nil
|
||||
}
|
||||
|
||||
// Strip !adventure prefix if present — dispatch directly to avoid recursion
|
||||
if strings.HasPrefix(strings.ToLower(body), "!adventure") {
|
||||
// Strip !adventure / !adv prefix if present — dispatch directly to avoid recursion
|
||||
if strings.HasPrefix(lower, "!adventure") || strings.HasPrefix(lower, "!adv") {
|
||||
return p.dispatchCommand(ctx)
|
||||
}
|
||||
|
||||
|
||||
Reference in New Issue
Block a user