Aether plugins provide a simple way to extend and tweak the behaviour of the client without having to modify the core code. Almost any action that occurs in the client can be hooked into and manipulated through plugins - only internal state for each component is inaccessible to plugins.
Plugins for Aether are written in Node v6 compatible JavaScript. Some features from ES6 and ES7 are unavailable in Aether plugins directly - instead, you should use a transpiler such as Babel and distribute the ES5-compatible code.
To understand how a plugin works, we must first understand how Aether is structured, and how actions from the IRC connection eventually reach the user.
The answer to all of that is Redux. For our purposes, all we need to know is this:
ClientPage
container.This ASCII diagram may illustrate the point:
ACTION ---> PLUGINS ---> REDUCERS ---> STORE ---> UI
| |
|--------------------<-----------------------------
^
CLIENT CONNECTION
Plugins are allowed to change actions, delete them completely or trigger new actions. There are also a few other things that plugins can do that don’t fit into the above cycle:
Plugins can require any built-in Node.js module, such as https
, fs
, or
net
. Libraries from npm
must be bundled with your plugin.
Aether plugins are, at their heart, just simple JavaScript objects that are
created with the new
syntax. Here are some examples of a minimal valid plugin
in both ES5 and ES6 syntax.
function MyPlugin(registerForHook, registerForMime, store, actions) {
this.name = 'Example Plugin';
this.author = 'ExampleCreator';
this.description = 'Acts as an example plugin.';
this.version = [1, 0, 0];
this.uuid = '49d8c38a-22ca-4b53-9133-70e5177bc2e7';
this.defaultSettings = {};
this.settings = [];
}
module.exports = MyPlugin;
class MyPlugin {
constructor(registerForHook, registerForMime, store, actions) {
this.name = 'Example Plugin';
this.author = 'ExampleCreator';
this.description = 'Acts as an example plugin.';
this.version = [1, 0, 0];
this.uuid = '49d8c38a-22ca-4b53-9133-70e5177bc2e7';
this.defaultSettings = {};
this.settings = [];
}
}
export default MyPlugin;
Plugins must provide the following values, as shown above:
name
- the user-friendly name to display to users which identifies your
pluginauthor
- a username to identify the creator of this plugin. It is preferred
that you use your GitHub username.description
- a moderately short description of what your plugin does.version
- a semantic version for your plugin, which each digit represented
separately in the array (e.g. v14.3.21
= [14, 3, 21]
)uuid
- A unique identifier (UUID) for your plugin. You can generate one
here. Important: every time you
change your defaultSettings
, you must generate a new UUID, or
else your new defaults will not be used.TODO.
TODO.
TODO.