Event handlers
You subscribe with client.on(...) and receive typed event payloads:
Middleware
client.use(...) lets you intercept events before downstream handlers:
Why this matters
Middleware is a good fit for:
- dropping bot messages
- guild allowlists
- rate limiting or coarse feature gates
- logging and metrics
Event typing
The event system is one of Chameleon’s best DX wins:
- the event name narrows the payload shape
event.type supports further narrowing in shared flows
- you avoid a lot of nullable probing that is common in untyped gateway payload handling
Last modified on June 13, 2026