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.

Properties

client
Client client [@property getter]

Client instance for the plugin.

config
Storage config [@property getter]

Config instance for the plugin.

configPath
string configPath [@property getter]

Returns path to this plugins config file.

log
Logger log [@property getter]

Plugin log instance.

options
PluginOptions options [@property getter]

PluginOptions instance for the plugin.

storage
Storage storage [@property getter]

Storage instance for the 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
void* 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 Listenable

listeners
ListenerObject[] listeners;
Undocumented in source.
loadListeners
void loadListeners()
Undocumented in source. Be warned that the author may not have intended to support it.
registerListener
void registerListener(ListenerObject obj)

Registers a listener from a ListenerObject

From mixin Commandable

commands
CommandObject[string] commands;
Undocumented in source.
loadCommands
void loadCommands()
Undocumented in source. Be warned that the author may not have intended to support it.
registerCommand
CommandObject registerCommand(CommandObject obj)

Registers a command from a CommandObject

Meta