twitchr-plugin-api v0.3.1
twitchr-plugin-api
This package provides a set of helpful interfaces describing the plugin API of twitchr. Every plugin should depend on this wrapper library.
Usage
This package is available via npm:
npm install --save twitchr-plugin-apiA basic plugin structure inside an index.ts file might look like this:
import * as api from 'twitchr-plugin-api';
...
const hooks: api.PluginEventListener = {
...
};
const plugin: api.Plugin = {
hooks: hooks,
};
export = plugin;Every plugin must export an object of type Plugin whose hooks property is used to define the plugin's event listeners.
Currently supported events are JOIN, PRIVMSG, NAMES and PART.
Each event listener takes a context argument which provides information about the respective event.
This context argument is also used to perform Twitch IRC related actions like ban() or timeout().
For a simple example see twitchr-example. Use it as a starting point.
Using TypeScript and building the plugin e.g. on prepublish is the recommended approach but using plain JavaScript works as well. In that case use this library as a reference only.
License
This project is licensed under the terms of the MIT license.