How krapmatt/krapbott works
Krapbott is a multi-platform chat bot with queue management and a web-based OBS control surface. Its main runtime receives Twitch and Kick chat events, routes them through channel-specific command dispatch, performs queue or moderation work, and sends replies; queue changes can also publish SSE updates. The tree documents additional Bungie, alias, channel-configuration, OAuth, and web-session capabilities. Sampled excerpts support the central event, queue, persistence, and authentication paths; wiring for other commands and web handlers is shown only where the tree establishes the subsystem, not as inferred calls.
Main entry points: db Database access · web Web endpoints · dispatcher.rs Command dispatcher · commands.rs Queue commands
Components 30
Chat runtime
- Application startup
src/main.rs - Event loop
src/bot/mod.rs - Event handler
src/bot/handler/handler.rs - Command dispatcher
src/bot/dispatcher/dispatcher.rs - Application state
src/bot/state/def.rs - Channel lifecycle
src/bot/runtime/channel_lifecycle.rs
Bot features
- Command registry
src/bot/commands/commands.rs - Queue commands
src/bot/commands/queue/commands.rs - Queue logic
src/bot/commands/queue/logic.rs - Moderation commands
src/bot/commands/moderation/commands.rs - Permissions
src/bot/permissions/permissions.rs
Web control
- Web endpoints
src/bot/web - Web authentication
src/bot/web/auth.rs - Web sessions
src/bot/web/sessions.rs - OBS queue controls
src/bot/web/obs.rs - Queue event stream
src/bot/web/sse.rs
Platform integrations
- Platform event loops
src/bot/platforms - Unified chat client
src/bot/handler/handler.rs - Twitch adapter
src/bot/platforms/twitch - Kick adapter
src/bot/platforms/kick - Platform APIs
src/api - Kick OAuth
src/api/kick_oauth.rs
Persistence
- Database access
src/bot/db - PostgreSQL
Other components
- Chat participant
- Twitch and Kick
- Kick OAuth service
- Twitch OAuth API
- OBS dashboard
- Web user
Connections 39
- Chat participant → Twitch and Kick: sends chat
- Twitch and Kick → Platform event loops: delivers events
- Application startup → Event loop: starts runtime
- Application startup → Web endpoints: serves routes
- Application startup → PostgreSQL: connects
- Event loop → Event handler: handles events
- Event handler → Channel lifecycle: starts channels
- Event handler → Command dispatcher: dispatches event
- Platform event loops → Event loop: sends events
- Command dispatcher → Command registry: resolves commands
- Command dispatcher → Permissions: checks access
- Queue commands → Queue logic: uses queue rules
- Queue commands → Database access: reads and updates
- Moderation commands → Database access: updates configuration
- Moderation commands → Command dispatcher: refreshes dispatch
- Queue commands → Unified chat client: sends replies
- Unified chat client → Twitch adapter: sends and joins
- Unified chat client → Kick adapter: sends and joins
- Kick adapter → Kick OAuth: obtains access token
- Twitch adapter → Twitch and Kick: connects to
- Kick adapter → Twitch and Kick: connects to
- Platform APIs → Twitch OAuth API: calls platform API
- Kick OAuth → Kick OAuth service: requests tokens
- Web authentication → Twitch OAuth API: exchanges credentials
- Web authentication → Kick OAuth: builds authorization
- Web endpoints → Web authentication: routes auth
- Web endpoints → OBS queue controls: routes OBS actions
- Web endpoints → Queue event stream: routes event stream
- Web user → Web endpoints: requests controls
- Web authentication → Database access: stores sessions
- Web sessions → Database access: reads sessions
- OBS queue controls → Web sessions: validates cookies
- OBS queue controls → Database access: reads and updates queue
- OBS queue controls → Queue event stream: publishes queue updates
- Queue event stream → OBS dashboard: streams events
- Queue commands → Queue event stream: publishes queue updates
- Database access → PostgreSQL: queries and persists
- Application state → Command dispatcher: holds runtime dispatchers
- Channel lifecycle → Platform event loops: joins configured channels