Add version system, tax tracking, lottery winner DMs, fmtEuro, audit fixes

- Version system: per-plugin versions via Versioned interface, crash_log and
  version_history DB tables, !version command, crash stats in !botinfo
- Tax tracking: tax_ledger table, trackTaxPaid across all communityTax and
  communityPotAdd sites, tax paid display in !stats and !superstatsexplusalpha
- Lottery: DM winners with winning ticket details and matched numbers bolded
- fmtEuro: generic currency formatter with thousand separators across all
  economy display paths
- Audit fixes: streak_decayed column for Streak Survivor achievement,
  combat_narrative empty-phase guard, crafting success rate integer division,
  RecordCrash nil-DB guard

Co-Authored-By: Claude Opus 4.6 <noreply@anthropic.com>
This commit is contained in:
prosolis
2026-04-18 01:07:25 -07:00
parent 42e6e23900
commit b15c13cde7
22 changed files with 600 additions and 75 deletions

View File

@@ -14,6 +14,26 @@ import (
"maunium.net/go/mautrix/id"
)
// fmtEuro formats a currency value with thousand separators, e.g. "€12,500".
func fmtEuro[T int | int64 | float64](v T) string {
n := int64(v)
if n < 0 {
return "-" + fmtEuro(-n)
}
s := fmt.Sprintf("%d", n)
if len(s) <= 3 {
return "€" + s
}
var out []byte
for i, c := range s {
if i > 0 && (len(s)-i)%3 == 0 {
out = append(out, ',')
}
out = append(out, byte(c))
}
return "€" + string(out)
}
// gamesRoom returns the configured GAMES_ROOM, or empty if unset.
func gamesRoom() id.RoomID {
return id.RoomID(os.Getenv("GAMES_ROOM"))
@@ -63,7 +83,8 @@ func NewEuroPlugin(client *mautrix.Client) *EuroPlugin {
}
}
func (p *EuroPlugin) Name() string { return "euro" }
func (p *EuroPlugin) Name() string { return "euro" }
func (p *EuroPlugin) Version() string { return "1.1.0" }
func (p *EuroPlugin) Commands() []CommandDef {
return []CommandDef{