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.

Constructors

this
this(PluginOptions opts)

Constructor for initial load. Usually called from the inherited constructor.

Members

Functions

load
void load(Bot bot, PluginState state)

Used to load the Plugin, initially loading state if requred.

name
string name()

Returns the name of this plugin.

unload
void unload(Bot bot)

Used to unload the Plugin. Saves config/storage if required.

Mixins

__anonymous
mixin Listenable
Undocumented in source.
__anonymous
mixin Commandable
Undocumented in source.
__anonymous
mixin StateSyncable
Undocumented in source.

Properties

client
Client client [@property getter]

Client instance for the Bot running this plugin

config
Storage config [@property getter]

Config instance for this plugin

configPath
string configPath [@property getter]

Returns path to this plugins config file.

log
Logger log [@property getter]

Plugin log instance.

me
User me [@property getter]

User instance for the account this bot is running under

options
PluginOptions options [@property getter]

PluginOptions for this plugin

storage
Storage storage [@property getter]

Storage instance for this plugin.

storageDirectoryPath
string storageDirectoryPath [@property getter]

Returns path to this plugins storage directory.

storagePath
string storagePath [@property getter]

Returns path to this plugins storage file.

Variables

bot
Bot bot;

Bot instance for this plugin. Should always be set

dynamicLibrary
DynamicLibrary dynamicLibrary;

Pointer to the dynamic library, used for cleaning up on shutdown.

dynamicLibraryPath
string dynamicLibraryPath;

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 state;

Current runtime state for this plugin

Mixed In Members

From mixin StateSyncable

stateLoad
void stateLoad(PluginState state)

Loads all custom attribute state from a PluginState.

stateUnload
void stateUnload(PluginState state)

Unloads all custom attributes into a PluginState.

Meta