How the-a-p-o-l-l-o-organization/apollo-discord-bot works
A.P.O.L.L.O is a modular Discord bot for server administration, moderation, tickets, automation, and utility commands. The main workflow is a Discord interaction entering the gateway, being dispatched to a plugin command (or queued for worker processing), and producing a Discord response; plugins also react to guild events. Redis-backed queues and locks support multi-instance operation, while SQLite/PostgreSQL provide persistence. The repository additionally contains optional Interlink cross-bot messaging and a Rust NSFW-classification service. The README documents product capabilities not represented in sampled source; their wiring is shown only where tree paths and explicit architecture documentation support it.
Main entry points: index.ts Gateway Runtime · PluginManager.ts Plugin Manager · jobHandler.ts Job Handler · nsfwClient.ts NSFW gRPC Client
Components 25
Bot Runtime
- Gateway Runtime
src/index.ts - Plugin Manager
src/core/PluginManager.ts - Plugin Event Bus
src/core/EventBus.ts
Guild Features
- Moderation
src/plugins/moderation/plugin.ts - Auto Moderation
src/plugins/automod/plugin.ts - Ticket System
src/plugins/tickets/plugin.ts - Admin and Logging
src/plugins/admin/plugin.ts - Utility Commands
src/plugins/utility/plugin.ts - Service Integrations
src/plugins/integrations/plugin.ts
Distributed Runtime
- Gateway Router
src/queue/gatewayRouter.ts - Job Queue
src/queue/queue.ts - Worker Runtime
src/worker.ts - Job Handler
src/queue/jobHandler.ts - Command Jobs
src/queue/jobs/processCommand.ts - Leader Election
src/gateway/leader.ts
State and Services
- Bot Database
src/utils/db.ts - Redis
src/utils/redis.ts
External Integrations
- Interlink Client
src/plugins/interlink/connectClient.ts - Interlink Service
services/interlink/internal/server/server.go - NSFW Analysis Job
src/queue/jobs/nsfwAnalyze.ts - NSFW gRPC Client
src/queue/nsfwClient.ts - NSFW Model Service
crates/nsfw-server/src/main.rs
Other components
- Discord User
- Discord Platform
- Twitch, YouTube, RSS
Connections 31
- Discord User → Discord Platform: sends interaction
- Discord Platform → Gateway Runtime: delivers interaction
- Gateway Runtime → Plugin Manager: loads plugins
- Gateway Runtime → Gateway Router: routes work
- Gateway Router → Job Queue: enqueues jobs
- Job Queue → Worker Runtime: dispatches jobs
- Worker Runtime → Job Handler: handles jobs
- Job Handler → Command Jobs: processes command
- Gateway Runtime → Discord Platform: responds via API
- Plugin Manager → Moderation: loads plugin
- Plugin Manager → Auto Moderation: loads plugin
- Plugin Manager → Ticket System: loads plugin
- Plugin Manager → Admin and Logging: loads plugin
- Plugin Manager → Utility Commands: loads plugin
- Plugin Manager → Service Integrations: loads plugin
- Moderation → Bot Database: persists cases
- Ticket System → Bot Database: persists tickets
- Admin and Logging → Plugin Event Bus: publishes events
- Plugin Event Bus → Redis: bridges cross-pod events
- Gateway Runtime → Leader Election: elects leader
- Leader Election → Redis: acquires lock
- Gateway Runtime → Bot Database: reads and writes state
- Gateway Runtime → Redis: uses shared services
- Service Integrations → Twitch, YouTube, RSS: queries services
- Gateway Runtime → Interlink Client: uses messaging
- Interlink Client → Interlink Service: sends envelopes
- Job Handler → NSFW Analysis Job: handles analysis
- NSFW Analysis Job → NSFW gRPC Client: requests detection
- NSFW gRPC Client → NSFW Model Service: calls gRPC
- NSFW Model Service → NSFW gRPC Client: returns classification
- Gateway Runtime → Discord Platform: receives guild events