Skip to content
thatvalterguy edited this page Feb 26, 2012 · 2 revisions

Skeleton

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;

Sample plugin

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 act parameter

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 (either act.channel if a public message or act.nick if 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 IRC Node API

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.

node.js API

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.

Clone this wiki locally