Getting Started
This page explains how to create your own plugin for AthenaBot using the Plugin Template. The internal Developer API makes it easy to extend AthenaBot’s functionality without touching the core code.
Familiarity with Node.js and discord.js is required to follow this documentation.
1. Setting up your editor
If you are using Visual Studio Code, you can enable typings for AthenaBot by creating a configuration file in the root directory. This will help you see available functions directly in your editor.
{
"compilerOptions": {
"module": "ESNext",
"moduleResolution": "Node",
"target": "ES2020",
"jsx": "react",
"strictNullChecks": true,
"strictFunctionTypes": true,
"baseUrl": "./",
"paths": {
"*": ["types/*"]
}
},
"exclude": [
"node_modules",
"**/node_modules/*"
]
}We also use ESLint to keep the codebase clean and consistent. If you want to follow the same style rules, create a file called .eslintrc.json in the root directory and paste the following:
2. Downloading the plugin template
Go to the Plugin Template repository.
Download the template files with Code → Download ZIP or clone it with Git.
Place the entire folder into your AthenaBot installation under
/plugins/.
Your directory structure should look like this:
3. Understanding the plugin template
Main file
Below is the entry point of your plugin. This example was taken from the template itself. We will go through the whole main.js file step by step.
The
heartobject is your access point to the Developer API, including logging, configs, and utilities.
Class constructor
Name: Your plugin name. Make sure this is unique.
Author: Your username.
Version: Your plugin version.
RequiredAthenaVersion: Specifies the minimum AthenaBot version needed for the plugin.
Priority: The higher the number, the earlier your plugin will be loaded.
Dependencies: List of plugin dependencies required for this plugin to run. All plugins depend on the core plugin.
softDependencies: Optional plugin dependencies.
nodeDependencies: Node.js dependencies that are installed before loading.
channels: Registered channels that can be configured through Athena’s
/setupcommand.dashboard.cannotDisable: If set to
true, the plugin cannot be disabled in the dashboard.
Config constructor
If your plugin does not offer a config, you can remove the following code snippet from your plugin template.
Line 1: Always keep the
heartobject for the config manager.Line 2:
nameis the config name. In this example, your config is calledhello.Line 3-17: This defines the structure of your plugin configuration file.
Important: Your configuration file must start with a top-level
configobject.
Last updated