Bot / structs/Module / Module
structs/Module.Module
The base structure for modules.
Modules are used to group pieces of functionality for any purpose you wish. All types of modules must have their own, and unique, handler which is responsible for importing and initializing modules from files.
-
Module↳
Listener
• new Module(handler)
Initializes a new Module instance.
| Name | Type | Description |
|---|---|---|
handler |
Handler<Module> |
The handler that manages the module. |
• Readonly category: string = 'default'
The category that the module belongs to.
Modules are pieces of functionality that are grouped together, however, modules can further be grouped together. This property can be used to group modules together within the handler.
For example, commands are pieces of modules that can be represented through
the Module class. In addition, modules can be grouped together by their
purpose, such as administration commands or music commands.
• Readonly handler: Handler<Module>
A reference to the handler that manages this module.
This property references the handler that manages the module, allowing the module to access the Discord client and other modules within the handler.
• Readonly logger: Logger = logger
The logging system.
A useful logging system that prints messages in a structured format, all logs are additionally stored in a file for future reference.
See
https://github.com/norviah/logger
• Readonly Abstract name: string
The module's name.
This will represent how the module is referenced within the handler and possible error messages.
• Readonly util: ModuleUtil
A collection of helpful methods for the module.
This property references a collection of helpful methods that can be used by the module.
▸ Optional initialize(): void
Further initialization logic for the module after it has been imported by the handler.
Once the handler has imported and initialized all modules, this method is called on each module. If desired, this method can be implemented to further initialize the module once imported.
void