From c9df282fdec301a0a7b4afd9e373a305080fc366 Mon Sep 17 00:00:00 2001 From: prosolis <5590409+prosolis@users.noreply.github.com> Date: Thu, 9 Jul 2026 18:32:23 -0700 Subject: [PATCH] N1/A5: ticket sales fund the community pot `!lottery pot` has always claimed "pot is funded by ... ticket sales", and the draw debits prizes from that pot -- but handleLotteryBuy only debited the player, so ticket euros were burned and the lottery ran as a pure drain on rake income from elsewhere. Credit the pot after lotteryInsertTickets succeeds, so the refund path can't strand money in it. Watch pot-drain-vs-rake per project_lottery_economics: if weekly pot growth jumps, tune the prize tiers rather than the ticket price. --- internal/plugin/lottery.go | 7 +++++++ 1 file changed, 7 insertions(+) diff --git a/internal/plugin/lottery.go b/internal/plugin/lottery.go index cc14b04..32f746d 100644 --- a/internal/plugin/lottery.go +++ b/internal/plugin/lottery.go @@ -125,6 +125,13 @@ func (p *LotteryPlugin) handleLotteryBuy(ctx MessageContext, args string) error return p.SendReply(ctx.RoomID, ctx.EventID, "Something went wrong buying tickets. You've been refunded.") } + // Ticket euros fund the pot, which is what `!lottery pot` has always + // claimed and what the draw assumes — prizes debit the pot, so without + // this the lottery is a pure drain on rake income from elsewhere. + // Credited only after the tickets persist, so the refund path above + // can't strand money in the pot. + communityPotAdd(int(cost)) + // Build confirmation. var sb strings.Builder sb.WriteString(fmt.Sprintf("🎟️ **%d ticket(s) purchased** — €%d\n\n", n, n))