For the complete documentation index, see llms.txt. This page is also available as Markdown.

Plugins

This page explains how to work with the internal Plugin API.

Plugin API

Dependencies

When integrating with other plugins and their handlers, you should first verify that the plugin is loaded. If the plugin is not loaded, attempting to fetch its handler returns null. You can check whether a plugin is loaded with:

const isLoaded = this.core.discord.core.plugin.manager.isLoaded('<plugin_name>');

This returns:

  • true if the plugin is loaded and available.

  • false if the plugin is not loaded.

Plugins

Let’s take a quick look at a plugin’s instance functions. In most cases, you will not need these directly, but here is how you can fetch a plugin:

const plugin = this.heart.core.discord.core.plugin.manager.get('<plugin_name>');

If the plugin is not found, this function returns null.

The following code snippets and explanations work similarly for plugins, commands, events, and schedules. The relevant imports are:

const command = this.heart.core.discord.core.command.manager.get('<command_name>');
const event = this.heart.core.discord.core.event.manager.get('<event_name>');
const schedule = this.heart.core.discord.core.schedule.manager.get('<schedule_name>');

Functions

  • plugin.getName(): Returns the name of the plugin.

  • plugin.getAuthor(): Returns the author of the plugin.

  • plugin.getVersion(): Returns the version of the plugin.

  • plugin.getPriority(): Returns the plugin’s load priority.

  • plugin.getDependencies(): Returns a list of required plugin dependencies.

  • plugin.getSoftDependencies(): Returns a list of optional soft dependencies.

  • plugin.getNodeDependencies(): Returns a list of required Node.js dependencies.

  • plugin.getChannelNames(): Returns the names of the plugin’s registered channels.

  • plugin.setDisabled(): Disables the plugin.

  • plugin.setEnabled(): Enables the plugin.

  • plugin.isEnabled(): Returns true if the plugin is enabled.

Last updated