How hmddevs/chat-guard works
Chat Guard is a Discord moderation bot. Server administrators configure protections and logging through slash commands; the bot stores those settings, evaluates incoming and edited messages against enabled guards and exemptions, then deletes violations, warns or escalates to a timed mute, and records moderation actions in the configured log channel. The sampled event and command handlers show those runtime boundaries; README capabilities not visible in the excerpts are represented only where the documented subsystem is supported by the tree.
Main entry points: db.js Guild settings model · app.js Bot client · login.js Login and registration · events.js Message events
Components 12
Bot runtime
- Bot client
app.js - Login and registration
src/login.js - Environment configuration
src/config.js
Message moderation
- Message events
src/events.js - Guard and exemption checks
src/functionz.js - Warnings and timed mutes
src/functionz.js
Configuration
- Slash commands
src/commands.js
Persistence
- Guild settings model
src/db.js - MongoDB
Other components
- Server admins
- Server members
- Discord API
Connections 20
- Server admins → Discord API: configure via
- Server members → Discord API: post messages
- Discord API → Bot client: delivers events
- Bot client → Login and registration: loads
- Bot client → Message events: loads
- Bot client → Slash commands: loads
- Login and registration → Environment configuration: reads
- Slash commands → Environment configuration: reads
- Login and registration → Discord API: registers commands
- Slash commands → Discord API: replies to interactions
- Message events → Guard and exemption checks: checks messages
- Message events → Guild settings model: reads settings
- Slash commands → Guild settings model: updates settings
- Guard and exemption checks → Guild settings model: reads exemptions
- Guard and exemption checks → Warnings and timed mutes: escalates violations
- Warnings and timed mutes → Guild settings model: updates escalation state
- Login and registration → MongoDB: connects
- Guild settings model → MongoDB: stores guild data
- Message events → Discord API: deletes or warns
- Warnings and timed mutes → Discord API: times out and logs