How pluralkit/pluralkit works
PluralKit is a Discord bot and companion service for plural communities. Its central workflow is Discord events reaching the bot, where messages can be matched to member proxy tags and relayed through webhooks; users also manage systems and members and track switches through commands. The repository additionally includes public/private APIs, a web dashboard, avatar processing, and dispatch integrations. The graph preserves these documented product areas, but several links are dashed where the sampled code does not show the runtime wiring.
Main entry points: ProxyService.cs Message proxying · ModelRepository.cs Model repository · IDatabase.cs Postgres database · Shard.cs Gateway shards
Components 19
Discord runtime
- Gateway shards
Myriad/Gateway/Shard.cs - Shard state
Myriad/Gateway/State/ShardStateManager.cs - Bot event router
PluralKit.Bot/Bot.cs - Event handlers
PluralKit.Bot/Handlers - Discord REST client
Myriad/Rest/DiscordApiClient.cs - Discord cache
Myriad/Cache/IDiscordCache.cs
Bot features
- Message proxying
PluralKit.Bot/Proxy/ProxyService.cs - Bot commands
PluralKit.Bot/Commands - Profile rendering
PluralKit.Bot/Services/EmbedService.cs
Core data
- System and member models
PluralKit.Core/Models - Model repository
PluralKit.Core/Database/Repository/ModelRepository.cs - Postgres database
PluralKit.Core/Database/IDatabase.cs
User interfaces
- HTTP API
crates/api/src/endpoints - Web dashboard
dashboard/src/App.svelte
Supporting services
- Webhook dispatch
PluralKit.Core/Dispatch/DispatchService.cs - Avatar processing
crates/avatars/src/main.rs - Scheduled services
crates/scheduled_tasks/src/main.rs
Other components
- Discord users
- Discord platform
Connections 19
- Discord platform → Gateway shards: sends events
README.md - Gateway shards → Shard state: handles packets
Myriad/Gateway/State/ShardStateManager.cs - Gateway shards → Bot event router: raises events
PluralKit.Bot/Bot.cs - Bot event router → Event handlers: routes events
PluralKit.Bot/Bot.cs - Event handlers → Message proxying: handles messages
- Discord users → Bot commands: issues commands
- Bot commands → Model repository: reads and writes
PluralKit.Bot/Commands/Member.cs - Bot commands → Profile rendering: renders profiles
PluralKit.Bot/Commands/System.cs - Message proxying → Model repository: loads proxy data
PluralKit.Bot/Proxy/ProxyService.cs - Message proxying → Webhook dispatch: dispatches updates
PluralKit.Bot/Proxy/ProxyService.cs - Message proxying → Discord REST client: relays messages
PluralKit.Bot/Proxy/ProxyService.cs - Profile rendering → Discord REST client: fetches Discord data
PluralKit.Bot/Services/EmbedService.cs - Profile rendering → Discord cache: fetches cached users
PluralKit.Bot/Services/EmbedService.cs - Model repository → Postgres database: queries data
PluralKit.Core/Database/Repository/ModelRepository.cs - Model repository → System and member models: loads models
- HTTP API → Postgres database: serves data
- Web dashboard → HTTP API: requests data
- Avatar processing → Postgres database: stores avatar data
- Scheduled services → Postgres database: runs scheduled work