zombi is a simple extensible bot for Jabber.
zombi is not maintained.
- A Jabber account.
- Node.js >= 0.4.7
- node-xmpp
- node-xml2js
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 botverbose
is if you want extra status messages
Run zombi:
node run.js
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:
name
- Name of the plugin.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.callback
- Code to execute for this command.
The order of arguments for the callback are as such:
body
- The regex matched message bodystanza
- 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;
- A majority of the code surrounding how plugins work and this readme was borrowed from https://github.com/jonursenbach/node-smores which borrowed a lot from https://github.com/indiefan/nodebot
- https://github.com/jmazzi/red was also very helpful