How devscord-team/watchman works
Watchman is a Discord moderation and server-management bot built on Devscord.DiscordFramework. A Discord message enters the framework’s middleware and router, reaches a Watchman controller or command, then domain operations can query or change persisted server data; responses and moderation actions return through Discord integration services. The tree also shows distinct capabilities for spam protection, muting, warnings, configuration, roles, custom commands, help, and event responses. Source samples chiefly establish database-backed query behavior; links among unsampled controllers, handlers, and services are shown only at the subsystem level.
Main entry points: Areas Feature controllers · QueryBus.cs Query bus · DiscordClient.cs Discord API · Muting Muting
Components 22
Discord runtime
- Watchman bot
Watchman.Discord/WatchmanBot.cs - Discord framework
Devscord.DiscordFramework/Workflow.cs - Message middleware
Devscord.DiscordFramework/Middlewares/MiddlewaresRunner.cs - Command router
Devscord.DiscordFramework/Routing/Router.cs - Command service
Devscord.DiscordFramework/Commands/Services/BotCommandsService.cs
Bot features
- Feature controllers
Watchman.Discord/Areas - Spam protection
Watchman.Discord/Areas/AntiSpam - Muting
Watchman.Discord/Areas/Muting - Warnings
Watchman.Discord/Areas/Warns - Administration
Watchman.Discord/Areas/Administration - Configuration
Watchman.Discord/Areas/Configurations - Custom commands
Watchman.Discord/Areas/CustomCommands - Help
Watchman.Discord/Areas/Help - Custom responses
Watchman.Discord/Areas/Responses - Messaging and users
Watchman.Discord/Areas/Messaging
Domain and CQRS
- Command bus
Watchman.Cqrs/CommandBus.cs - Query bus
Watchman.Cqrs/QueryBus.cs - Domain handlers
Watchman.DomainModel
External integration
- Mongo session store
- Discord API
Devscord.DiscordFramework/Integration/Services/DiscordClient.cs - Discord services
Devscord.DiscordFramework/Services/MessagesService.cs
Other components
- Discord users
Connections 30
- Discord users → Discord API: sends events
- Discord API → Discord framework: delivers events
- Discord framework → Message middleware: runs pipeline
- Message middleware → Command router: passes context
- Command router → Command service: dispatches commands
- Command service → Feature controllers: invokes handlers
- Feature controllers → Spam protection: routes protection
- Feature controllers → Muting: routes mute actions
- Feature controllers → Warnings: routes warning actions
- Feature controllers → Administration: routes administration
- Feature controllers → Configuration: routes settings
- Feature controllers → Custom commands: routes commands
- Feature controllers → Help: routes help
- Feature controllers → Custom responses: routes response actions
- Feature controllers → Messaging and users: routes messaging
- Spam protection → Query bus: queries protection data
- Muting → Command bus: dispatches mute operations
- Muting → Query bus: queries mute events
- Warnings → Query bus: queries warnings
- Configuration → Query bus: queries settings
- Administration → Command bus: dispatches role changes
- Custom commands → Query bus: queries commands
- Help → Query bus: queries help data
- Custom responses → Query bus: queries responses
- Command bus → Domain handlers: dispatches commands
- Query bus → Domain handlers: dispatches queries
- Domain handlers → Mongo session store: reads and writes
- Messaging and users → Discord services: sends messages
- Discord services → Discord API: uses client
- Discord API → Discord users: sends responses