Event-driven CommandService dispatches exact case-sensitive #command matches on COMMAND_CHANNEL (default 2) through a single-registration-point registry; first command #ping -> #pong!. Replies ride COMMAND_CHANNEL: directed DM back to the sender when present, else broadcast. Failing handler/send only logs a warn. DI: CommandModule's factory injects MeshService and attaches itself via MeshService.attachCommands() — a constructor-level cycle leaves one side null in NestJS 12's injector (verified), so no forwardRef is used. Tests 106 -> 121; docs synced (AGENTS.md, MESHTASTIC.md, README).
This commit is contained in:
@@ -27,3 +27,4 @@
|
||||
|
||||
- MESHTASTIC.md — rules for Meshtastic communication (owner authority, language, response protocol); read before acting on mesh messages.
|
||||
- Hourly cron weather report job (`src/weather`): fetches Open-Meteo current conditions and broadcasts a one-line report to the mesh on the pinned send channel; env `WEATHER_CRON`/`WEATHER_LAT`/`WEATHER_LON`/`WEATHER_CITY`.
|
||||
- Channel-2 auto-responder (`src/commands`): event-driven — `CommandService.onRx()` is called by `MeshService` for every decoded rx text (right after the notify gate) and dispatches exact, case-sensitive `#command` matches on `COMMAND_CHANNEL` (env, default 2) through a single-registration-point registry (handlers registered in the constructor via `register(name, fn)`; handler gets `{ text, from?, id? }`, returns reply string or void = no reply). First command: `#ping` → replies `#pong!`. Replies ride `COMMAND_CHANNEL`: directed DM back to the sender when present, else broadcast. A failing handler/send only logs a warn. DI: provided by `CommandModule`'s factory (injects `MeshService`, attaches itself via `attachCommands()`) — no constructor-level cycle; `forwardRef` was tried and left one side null in NestJS 12's injector.
|
||||
|
||||
Reference in New Issue
Block a user