Class Plugin

A Plugin represents a modular, extendable class that encapsulates certain Bot functionality into a logical slice. Plugins usually have a set of commands and listeners attached to them, and are built to be dynamically loaded/reloaded into a Bot.

Inherits from

  • Object (base class)

Constructors

Name Description
this Constructor for initial load. Usually called from the inherited constructor.

Fields

Name Type Description
bot Bot Bot instance for this plugin. Should always be set
dynamicLibrary void* Pointer to the dynamic library, used for cleaning up on shutdown.
dynamicLibraryPath string The path to the dynamic library this plugin was loaded from. If set, this signals this Plugin was loaded from a dynamic library, and can be reloaded from the given path.
state PluginState Current runtime state for this plugin

Properties

Name Type Description
client [get] Client Client instance for the Bot running this plugin
config [get] Storage Config instance for this plugin
configPath [get] string Returns path to this plugins config file.
log [get] std.experimental.logger.core.Logger Plugin log instance.
me [get] User User instance for the account this bot is running under
options [get] PluginOptions PluginOptions for this plugin
storage [get] Storage Storage instance for this plugin.
storageDirectoryPath [get] string Returns path to this plugins storage directory.
storagePath [get] string Returns path to this plugins storage file.

Methods

Name Description
load Used to load the Plugin, initially loading state if requred.
name Returns the name of this plugin.
unload Used to unload the Plugin. Saves config/storage if required.