How itsme-to/itsmybot works
Main Components
• Bot Core: This is the heart of the application (located in src/core). It includes foundational modules such as contracts, builders, configuration, and resource management.
• Core Services: Under src/core/services, you have a number of services such as:
– Command Service: Processes commands, located in services/commands.
– Event Service: Handles various Discord events (message, interaction, presence, etc.) found under services/events.
– Action Service: Executes actions like sending messages or adding roles (services/actions).
– Engine Service: Manages scripts, custom commands, and event broadcasting.
– Condition Service: Checks conditions that determine if specific actions should run.
– Component Service: Handles various interactive components.
– Expansions, Leaderboards, Plugins, and Users services: Each of these adds additional functionality.
• Resources & Configuration: Resources (YAML and TS files) define commands, config, and language settings. They are used by both the core and plugin system.
• Plugin System: Found in src/plugins, this allows third-party or extended functionalities to be added and managed, interfacing with and extending core services.
Relationships and Interactions
• The Bot Core orchestrates calls to core services based on Discord events.
• Core services (command, event, action, etc.) are interconnected; for example, receiving an event might trigger a command execution which in turn queries the condition and then performs an action.
• The plugin system dynamically loads plugins, which typically register their own commands, events, and resources. Plugins depend on core contracts to integrate.
• Central configuration and resource files (YAML/TS) are shared across modules to ensure consistency in settings, commands, and language definitions.
Important Architectural Patterns
• Modular Design: Separation between the core engine and plugins allows for extensibility.
• Service-Oriented Architecture: Each service (commands, events, actions, conditions, etc.) is structured as an independent module with a clear contract for interaction.
• Configuration-Driven Behaviour: YAML and TS configuration files drive runtime behavior, offering flexibility and easier maintenance.