Complete Event Flow Diagram
Detailed Event Flows
1. Message Processing Flow
2. Voice Channel Flow
3. Slash Command Flow
4. Attachment Processing Flow
5. Multi-Server Event Flow
Event Type Reference
Discord.js Events
elizaOS Events Emitted
State Management
Message Context
Voice Context
Error Handling in Event Flow
Error Propagation
Performance Considerations
Event Batching
For high-volume servers, events are batched:Connection Pooling
Voice connections are pooled to reduce overhead:Monitoring Event Flow
Event Metrics
Track event processing metrics:Best Practices
-
Event Debouncing
- Debounce rapid events (typing indicators, voice state)
- Batch similar events when possible
-
Error Isolation
- Don’t let one event error affect others
- Use try-catch at event handler level
-
Resource Management
- Clean up event listeners on disconnect
- Limit concurrent event processing
-
Monitoring
- Track event processing times
- Monitor error rates by event type
- Alert on unusual patterns