modules.base.admin.module

Module Contents

Classes

Repository

Module repository.

Admin

Bot administration functions.

Functions

setup(bot) → None

Attributes

tr

bot_log

guild_log

config

modules.base.admin.module.tr
modules.base.admin.module.bot_log
modules.base.admin.module.guild_log
modules.base.admin.module.config
class modules.base.admin.module.Repository(path: str, valid: bool, message: str, message_vars: dict = None, *, name: str = None, modules: tuple = None, version: str = None)

Module repository.

This object is used when working with the repo command.

class modules.base.admin.module.Admin(bot)

Bot administration functions.

cog_unload(self)

Cancel status loop on unload.

async repository(self, ctx)
async repository_list(self, ctx, query: str = '')
async repository_install(self, ctx, url: str)
async repository_update(self, ctx, name: str)
async repository_uninstall(self, ctx, name: str)
async module(self, ctx)
async module_load(self, ctx, name: str)
async module_unload(self, ctx, name: str)
async module_reload(self, ctx, name: str)
async config_(self, ctx)
async config_get(self, ctx)
async config_set(self, ctx, key: str, value: str)
async lemon_(self, ctx)
async lemon_restart(self, ctx)

This won’t work without system-level error detection.

async lemon_shutdown(self, ctx)
static _download_repository(url: str, path: str) Optional[str]

Download repository to given directory.

Parameters
  • url – A link to valid git repository.

  • path – Path for git to download the repository.

Returns

An error that occured or None.

static _get_repository_list(query: str = '') List[str]

Get list of repositories

Parameters

query – A string that has to be part of the module name.

Returns

List of found module names.

static _get_repository(path: str) Repository

Verify the module repository.

The file __init__.py has to have variables __name__, __version__ and __all__.

__name__ must be a valid name of only lowercase letters and -.

__all__ must be a list of modules, all of which have to exist as directories inside the directory the path points to. All modules must be lowercase ascii only.

Parameters

path – A path to cloned repository.

Returns

Repository object.

static _install_module_requirements(path: str) Optional[subprocess.CompletedProcess]

Install new packages from requirements.txt file.

Parameters

path – A Path to the repository.

Returns

subprocess.CompletedProcess in case of succesfull installation, guilded.Embed if installation fails, None if the file was not found.

modules.base.admin.module.setup(bot) None