How felipebonfim2006/basebot works
BaseBot is a Discord bot supporting prefix and slash commands, per-server prefix and slash-command settings, utility and moderation features, and MongoDB-backed state. The main flow starts at the Discord client: message events resolve prefix commands, while interaction events handle slash commands; command handlers respond through Discord and may read or update MongoDB. Startup connects to MongoDB and loads command and event handlers. The event-handler and command-loading internals are not shown, so those links are marked unverified where appropriate.
Main entry points: moderacao Moderation Commands · index.js Client Startup · messageCreate.js Message Event · Events.js Event Loader
Components 15
Bot Runtime
- Client Startup
index.js - Event Loader
src/handlers/Events.js - Command Loader
src/handlers/Commands.js - Ready Event
src/events/client/ClientReady.js - Message Event
src/events/client/messageCreate.js - Interaction Event
src/events/client/interactionCreate.js - Bot Configuration
src/configs/ex.config.json
Commands
- Moderation Commands
src/commands/moderacao - Utility Commands
src/commands/utilidades
Persistent State
- Guild Settings
src/database/models/Guild.js - User Statistics
src/database/models/User.js - MongoDB Connection
src/database/mongoose.js
Discord Integration
- Discord API
Other components
- Bot Operator
- Discord Users
Connections 27
- Bot Operator → Client Startup: starts bot
README.md - Client Startup → MongoDB Connection: connects database
index.js - Client Startup → Event Loader: loads handler
index.js - Client Startup → Command Loader: loads handler
index.js - Client Startup → Discord API: logs in
index.js - Client Startup → Bot Configuration: reads credentials
index.js - Event Loader → Ready Event: registers events
- Event Loader → Message Event: registers events
- Event Loader → Interaction Event: registers events
- Command Loader → Moderation Commands: loads commands
- Command Loader → Utility Commands: loads commands
- Discord Users → Message Event: sends messages
src/events/client/messageCreate.js - Message Event → Guild Settings: reads prefix
src/events/client/messageCreate.js - Message Event → Moderation Commands: dispatches prefix
src/events/client/messageCreate.js - Message Event → Utility Commands: dispatches prefix
src/events/client/messageCreate.js - Discord Users → Interaction Event: sends interactions
README.md - Interaction Event → Moderation Commands: dispatches slash
- Interaction Event → Utility Commands: dispatches slash
- Moderation Commands → Guild Settings: updates settings
src/commands/moderacao/setprefix.js - Moderation Commands → Guild Settings: toggles commands
src/commands/moderacao/addslash.js - Moderation Commands → Discord API: registers commands
src/commands/moderacao/addslash.js - Moderation Commands → Discord API: removes commands
src/commands/moderacao/removeslash.js - Moderation Commands → User Statistics: updates usage
src/commands/moderacao/clear.js - Utility Commands → User Statistics: updates usage
src/commands/utilidades/ping.js - Ready Event → Guild Settings: reads enabled servers
src/events/client/ClientReady.js - Ready Event → Discord API: syncs commands
src/events/client/ClientReady.js - MongoDB Connection → Bot Configuration: reads URI
src/database/mongoose.js