Files
miti99bot/internal/modules/util/util.go
T
tiennm99 0584b094d1 feat(modules): port util + misc; expose Registry to handlers
Phase 5a of go-port-cloud-run plan: port first 2 of 4 modules (wordle/loldle
deferred to later phase). Port util.go, info.go, help.go, stickerid.go and
misc.go with tests. /help renders registry view; /info exposes chat/thread/
sender ids; /stickerid (private) returns bot-scoped file_ids; /ping writes
last_ping KV ms-epoch JSON for byte-parity, /mstats reads it, /fortytwo is
easter egg.

Registry-pointer-in-Deps required for /help to access module registry—pointer
captured at factory time, stable post-Build. Static factory catalog moved from
modules pkg to cmd/server to break import cycle. Code-review fixes applied in
same session: /info nil-deref guard, KV wire-format parity.
2026-05-09 08:24:52 +07:00

21 lines
598 B
Go

// Package util implements /info, /help, /stickerid — the framework-validating
// "always on" module. /help is a pure renderer over the registry; the other
// two are debug helpers.
package util
import (
"github.com/tiennm99/miti99bot-go/internal/modules"
)
// New is the module Factory. Closes over Deps so each handler has access to
// the registry (for /help) and to the bot framework (for sending replies).
func New(deps modules.Deps) modules.Module {
return modules.Module{
Commands: []modules.Command{
infoCommand(),
helpCommand(deps.Registry),
stickerIDCommand(),
},
}
}