Files
tiennm99bot/internal/modules/loldle/champions.go
T
tiennm99 ec77a24db7 chore: drop CF→AWS migration tooling and stale JS-port references
The CF→AWS data migration (closed 2026-05-16) is long done and the
tooling isn't wired into any production path. Remove the one-shot binary,
its support package, and the migration runbook.

In live code, replace 'JS-parity' / 'same shape as JS' / 'cross-runtime
KV migration' comments with the real, stable reason for each behavior
(wire-format invariant, null-vs-zero distinction, CloudWatch alarm field
name, etc.). 24 files touched across lolschedule, loldle, wordle, twentyq,
trading, misc, util, server, metrics, ai, keylock.

- delete cmd/migrate_cf_data/
- delete internal/migration/
- delete docs/cf-to-aws-migration-runbook.md
2026-05-25 09:39:17 +07:00

44 lines
1.4 KiB
Go

// Package loldle implements the loldle classic mode — guess the League
// champion from attribute hints (gender, species, regions, etc.).
package loldle
import (
_ "embed"
"encoding/json"
"fmt"
)
// Champion is one row of champions.json. Field tags match loldle.net's
// scraped schema verbatim so the embedded JSON file can be regenerated from
// the upstream scrape without a transform step.
type Champion struct {
ChampionName string `json:"championName"`
Gender string `json:"gender"`
Positions []string `json:"positions"`
Species []string `json:"species"`
Resource string `json:"resource"`
RangeType []string `json:"range_type"`
Regions []string `json:"regions"`
ReleaseDate string `json:"release_date"` // YYYY-MM-DD
}
// rawChampions holds the embedded JSON byte stream — the loldle.net champion
// dictionary scraped offline and checked into data/champions.json.
//
//go:embed data/champions.json
var rawChampions []byte
// loadChampions parses the embedded JSON. Panics on malformed data —
// a corrupt regen of champions.json is a build-time bug, not a runtime
// concern worth recovering from.
func loadChampions() []Champion {
var cs []Champion
if err := json.Unmarshal(rawChampions, &cs); err != nil {
panic(fmt.Sprintf("loldle: cannot decode champions.json: %v", err))
}
if len(cs) == 0 {
panic("loldle: champions.json contained no records")
}
return cs
}