How urstrulycherry/mybot works
Main Components
• Entry Point & Core Engine:
• Index.ts as the starting point.
• A “Bot Engine” or “Message Dispatcher” component which receives incoming messages, interprets the command based on prefixes (".", "!", "#", "$"), and delegates to the appropriate module.
• Modules (Command Handlers):
• “modules” folder where each file (e.g., alive, calc, chat, cricket, currency, etc.) is an individual command module.
• Sub-folder “socialMedia” as a specialized group of modules handling media from platforms like Twitter, Instagram, and YouTube.
• Utility Services:
• Configuration & Data:
• Configuration aspect by including the “data” folder (with config.json and settings.json) along with the global configuration file (conf.ts); note these provide runtime parameters.
• External Dependencies:
• Use of external packages such as whatsapp-web.js, Puppeteer (via puppeteerManager.ts), and possibly others referenced in package.json. These are critical for the bot’s interactions and capabilities.
Relationships and Interactions
• Dependency from the Command Modules to the Utility Services for supporting operations like reply formatting, external requests, and media handling.
• Flow from configuration data into both the main engine and various modules so they can access global settings.
Architectural Patterns & Design Principles
• Modular Design: Emphasize that each chat command is implemented as its own module, making the system extensible (new features/modules can be added following the skeleton provided in the Contribution section of the README).
• Separation of Concerns: Distinct handling of core logic (message dispatch, configurations) versus module-specific implementations.
• Configuration-driven: The presence of configuration files (data/config.json, data/settings.json, and conf.ts) suggests that runtime behavior can be controlled externally, an important layer in the architecture.
• Consistent Interface: The common function signature for each module (as shown in the README snippet) signifies a uniform interface that aids in dynamic module loading.
• Be as detailed as possible by breaking the project down into its essential architectural elements.
• Clearly articulate the contract between the Bot Engine and the modules (the uniform process interface).
• Clarity around external integrations (WhatsApp for receiving messages, social media for downloading content).