Skip to content

API Documentatio

Through the api you are able to interact with the bot in order to make your customizations. This api offers several functions, variables or objects you can use

Exported by /core/logger.js

Exposes the loggin system methods, such as warn, info, debug, success and error

export async function run(api) {
api.logger.info("This is an info message");
api.logger.success("This is an success message");
api.logger.debug("This is an debug message");
api.logger.warn("This is an warn message");
api.logger.error("This is an error message");
}

Exported by /core/bot/client.js

A JSObject that contains the Discord Client object

A JSObject that contains the JavaScript Object representation of the config.json of the bot.

An Array containing the name of all the modules successfully loaded.

An Array containing the JavaScript Object representation of the metadata.json for each module

Exported by /core/modules/installer.js

A method to automatically run the npm install command, to install packages required by your module before they are loaded

Returns the installed package

export async function run(api) {
// This returns the installed package as if imported
const yaml = await api.installPackage('js-yaml');
await runAfterModulesInstalled(api); // IMPORTANT `await`
}
async function runAfterModulesInstalled(api) {
// Optional. you can use this in any other file, to import the module
const yaml = import('js-yaml');
// Other code goes here
}
// Note: the default import `import module from "package";` won't work most of the time

Exported by /core/modules/restarter.js

A method to automatically restart the NodeJS process. Not supported in some environments

export async function run(api) {
api.restart();
}