neverender / zombi

extensible node.js jabber bot

Geek Repo:Geek Repo

Github PK Tool:Github PK Tool

zombi

zombi is a simple extensible bot for Jabber.

zombi is not maintained.

Requirements

Running zombi

Copy config.js-dist over to config.js and edit in the appropriate values for your Jabber account.

  • username is the user and domain of your account.
  • password is the password of the user you want to act as your bot.
  • rooms is an array of the rooms you want to connect to. If you want to connect to 'main' and 'non-main' it would be ['main', 'non-main']
  • nickname is a name you can give to your bot
  • verbose is if you want extra status messages

Run zombi:

node run.js

Plugins

zombi is controlled via plugins in /plugins, and as such, has an easy to use plugin interface.

Plugins consist of a singular function with a command that consists of at least three variables:

  1. name - Name of the plugin.
  2. regex - Regex applied to messages to capture and execute this command. This can be an array of regular expressions if your plugin requires multiple triggers.
  3. callback - Code to execute for this command.

The order of arguments for the callback are as such:

  • body - The regex matched message body
  • stanza - The stanza object as returned from XMPP.
  • zombi - The instance of the zombi object.

The following is a simple plugin to respond to "ping" with "pong".

/**
 * zombi plugin to respond to a 'ping'.
 *
 */
function Command() {
  this.name = "ping";
  this.regex = /ping/;
  this.description = "Respond to a ping.";
  this.callback = function(body, stanza, zombi) {
    zombi.say('pong', stanza);
  }
};

exports.Command = Command;

Mentions

About

extensible node.js jabber bot


Languages

Language:JavaScript 100.0%