Module structure
A module is a Python module (directory with __init__.py
file) of a special structure.
Structure example
The heart of the module is the BaseModule
super-class, which provides the necessary API for the module's operation, as well as performs its initialization. The module class must inherit from BaseModule
In __init__.py
there must be an import of a new module class, otherwise the loader just won't see it
All information about the module is described in the YAML file info.yaml
. It includes: title, author, version, description, and permissions (more about them later). An example of such a file:
ModuleExtension
classes allow you to break module code into files without losing important class attributes. In the example above, the files with extensions are located in the extensions
folder, although they can be located however you want, it's up to you.
The module has a built-in translation system. When loading, the module checks the strings folder, and loads the translation files as dictionaries into the rawS
attribute, then selects the currently active language (specified in the bot's config) and loads it into the S
attribute. Example usage:
Last updated