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

client
Client client()

Client instance for the Bot running this plugin

config
Storage config()

Config instance for this plugin

configPath
string configPath()

Returns path to this plugins config file.

load
void load(Bot bot, PluginState state)

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

log
Logger log()

Plugin log instance.

me
User me()

User instance for the account this bot is running under

name
string name()

Returns the name of this plugin.

options
PluginOptions options()

PluginOptions for this plugin

storage
Storage storage()

Storage instance for this plugin.

storageDirectoryPath
string storageDirectoryPath()

Returns path to this plugins storage directory.

storagePath
string storagePath()

Returns path to this plugins storage file.

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.

Variables

bot
Bot bot;

Bot instance for this plugin. Should always be set

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 Listenable

From mixin Commandable

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