How ahmii-kun/d-mail-whatsapp-bot works
D-Mail is a Baileys-based WhatsApp utility and group-management bot. A WhatsApp event enters through the connection layer, is emitted to the application, and messages are handled, checked, and dispatched to commands; group events trigger welcome/farewell and moderation behavior. The graph also preserves documented capabilities such as media utilities, group controls, bot modes, and anti-delete. Some wiring is dynamic and several modules were only partially excerpted, so uncertain relationships are omitted rather than inferred.
Main entry points: message.js Message dispatch · base.js Command contract · config.js Runtime configuration · database.js Database access
Components 22
Bot runtime
- Application wiring
app.js - WhatsApp connection
src/hub/connection.js - Socket lifecycle
src/hub/helper.js
Message handling
- Message interface
src/frameWork/interface.js - Message model
src/frameWork/sanitize.js - Message dispatch
src/handler/message.js - Group and message events
src/handler/events.js
Bot capabilities
- Command registration
src/frameWork/commands.js - Command contract
src/frameWork/Command/base.js - Utility commands
src/Commands/core - Group controls
src/Commands/group - Media commands
src/Commands/media - Moderator commands
src/Commands/mod
State and setup
- Session authentication
src/hub/auth.js - Web host and auth UI
src/hub/host.js - Runtime configuration
src/config.js - Database access
src/frameWork/database.js - Shared utilities
src/lib/utils.js
Other components
- WhatsApp users
- Baileys transport
- MongoDB
- YouTube search service
Connections 27
- WhatsApp users → Baileys transport: sends events
- Baileys transport → WhatsApp connection: delivers events
- Application wiring → WhatsApp connection: starts
app.js - Application wiring → Message dispatch: routes messages
app.js - Application wiring → Group and message events: routes events
app.js - WhatsApp connection → Socket lifecycle: delegates lifecycle
src/hub/connection.js - Socket lifecycle → Session authentication: loads auth
src/hub/helper.js - Socket lifecycle → Runtime configuration: initializes
src/hub/helper.js - Runtime configuration → Database access: creates
src/config.js - Runtime configuration → Message interface: creates
src/config.js - Runtime configuration → Command registration: creates
src/config.js - Runtime configuration → Web host and auth UI: imports
src/config.js - Session authentication → Database access: stores session
src/hub/auth.js - Database access → MongoDB: connects and stores
src/frameWork/database.js - Message dispatch → Database access: reads user and group state
- Message dispatch → Command registration: selects commands
- Message dispatch → Command contract: runs command
src/handler/message.js - Command contract → Utility commands: implemented by
src/Commands/core/retrieve.js - Command contract → Group controls: implemented by
src/Commands/group/enable.js - Command contract → Media commands: implemented by
src/Commands/media/ytsearch.js - Command contract → Moderator commands: implemented by
src/Commands/mod/mode.js - Media commands → YouTube search service: searches videos
src/Commands/media/ytsearch.js - Media commands → Shared utilities: formats and fetches
src/Commands/media/ytsearch.js - Group and message events → Database access: reads group settings
src/handler/events.js - Group and message events → Baileys transport: sends group messages
src/handler/events.js - Message dispatch → Baileys transport: replies and moderates
- Web host and auth UI → WhatsApp users: supports web authentication