mirror of
https://github.com/tiennm99/miti99bot.git
synced 2026-07-31 14:21:11 +00:00
4955797f2bdc7b9f0c0c1c7ca18a39788b31442c
Phase 6d of the go-port-cloud-run plan. Adds the fourth loldle variant — guess the champion from a splash art (any skin, including non-Default). - internal/modules/loldlesplash: champions.go (embed splashes.json, 10557-line DDragon-sourced pool with SplashChampion + Skin types), state.go (gameState gains a `skinId` field so the same splash shows across guesses; default 4 guesses — splash is harder than ability since non-Default skins are in rotation), handlers.go (sendPhoto path uses the DDragon CDN splash URL via models.InputFileString), loldlesplash.go (Module Factory). - Reuses internal/modules/util/chathelper and internal/champname. - 4 commands wired: loldle_splash (public), loldle_splash_giveup (public), loldle_splash_stats (public), loldle_splash_setmax (private). - 13 tests: lookup (embed shape + DDragon URL prefix + Default skin invariant), state (skinId round-trip + JS-wire-format decode + default 4), handlers (sendPhoto with correct URL, win, unknown, giveup with skin label, stats, setmax owner + non-owner). go test -race -count=1 ./... clean (18 packages); golangci-lint clean.
miti99bot-go
Plug-n-play Telegram bot framework in Go, deployed on Google Cloud Run with Firestore + Gemini. Free-tier port of miti99bot.
Status
Early scaffolding. See plans/260508-2222-go-port-cloud-run/plan.md for the full roadmap.
| Phase | What | Status |
|---|---|---|
| 01 | GCP setup, Cloud Run baseline | pending |
| 02 | Repo bootstrap + webhook skeleton | partial (local pieces done; Cloud Run deploy deferred to Phase 01) |
| 03 | Module framework + KVStore | done |
| 04+ | Firestore, modules, cron, CI/CD, cutover | pending |
Layout
cmd/server/ entrypoint
internal/server/ HTTP routes (/, /webhook, /cron/{name})
internal/telegram/ Telegram webhook + bot wrapper
internal/modules/ Module framework, registry, dispatchers
internal/storage/ KVStore interface, in-memory impl, prefix wrapper
Run locally
TELEGRAM_BOT_TOKEN=… \
TELEGRAM_WEBHOOK_SECRET=local \
PORT=8080 \
MODULES= \
go run ./cmd/server
End-to-end smoke test against a Telegram dev bot requires ngrok (local) or a Cloud Run deployment. The dev bot is created manually; token is injected via env vars only.
Test
go vet ./...
go test ./...
Build
docker build -t miti99bot-go .
The image is multi-stage (golang:1.23-alpine → gcr.io/distroless/static:nonroot); resulting image is ~15 MiB.
License
Description
Plug-n-play Telegram bot framework on Cloudflare Workers with grammY. Modules load via env var, three command visibility levels, KV storage behind a swappable interface.
bot-frameworkcoolifycrongeminigoleague-of-legendslong-pollingmongodbmongodb-atlaspaper-tradingself-hostedtelegramtelegram-botwordleworld-cup
Readme
Apache-2.0
3.7 MiB
Languages
Go
99.9%
Dockerfile
0.1%