🤖 Additional bot functions
Here you can see additional bot features to use when creating modules.
📥 Load module
def load_module(self, name: str) -> Optional[str]:INFO
Where name is the name of the module folder, followed by the internal name. Returns the base name of the module (specified in config.yaml) on success, and None on failure
📤 Unload module
def unload_module(self, name: str):INFO
name by analogy with load. Doesn't return anything
WARNING
Don't forget to use the on_unload callback to safely terminate all event loops (or other tasks), otherwise it risks leaking them into memory
✅ Downloading module
Modules are only installed from remote git repositories
def install_from_git(self, url: str) -> (int, str):INFO
url - Link to the remote repo. Returns a tuple of git and STDOUT exit code
🔃 Check for module updates
def check_for_updates(self, name: str, directory: str) -> Optional[bool]:INFO
name - internal name of the module or extension, directory - the folder with the modules or extensions. Returns True if there are new commits, False if up-to-date, or None on error
🔄 Updating a module/extension
def update_from_git(self, name: str, directory: str) -> (int, str):INFO
name - internal name of the module or extension, directory - the folder with the modules or extensions. Returns a tuple of git and STDOUT output code
🗑️ Deleting a module
def uninstall_module(self, name: str) -> bool:INFO
name - internal name of the module. Returns True - success, False - failure
⬇️ Getting an internal name from a common name
def get_int_name(self, name: str) -> Optional[str]:INFO
name - module name. Returns the internal module name on success.