-
Notifications
You must be signed in to change notification settings - Fork 1
PluginDevelopment
thatvalterguy edited this page Feb 26, 2012
·
2 revisions
This is the very basic skeleton, which can be used as a starting point for new plugins. The plugin can be extended however you (the developer) wish.
var irc = global.irc;
var plugin_handler = function (act) {
// TODO Handle the command here.
};
// TODO Change 'plugin' to your plugin name
exports.name = 'plugin';
exports.handler = plugin_handler;The plugins/sample.js file is a plugin example with basic functionality. It also contains commenting explaining everything there. Therefore it is advised to look at how it is built.
The handler recieves one parameter, which is the action. By standard, it is referred to as act. It can be used as:
-
act.nick-- the nick of the sender -
act.user-- the username of the sender -
act.host-- the host of the sender -
act.channel-- the channel message was sent in (is the bot's nick if private message) -
act.source-- the source of the message (eitheract.channelif a public message oract.nickif private message) -
act.cmd-- the command called in the message -
act.params-- the array of parameters given in the message -
act.data-- the raw message data
The bot contains it's own API which can be accessed through the irc object. You can read about in the plugin API documentation wiki page.
The bot is based on node.js. Their API can be used in plugins without any problems extending them even more.
Documentation for node.js API can be found here.