xmpp-bot
A bot that handles commands for you
Usage
const XMPPBot = ; let bot = jid: 'juliet@capulet.tld' password: 'romeo' rooms: jid: 'coven@chat.shakespeare.lit' nick: 'juliet' // register a commandbot // or just return answerbot // disconnect when you're done (automatically done on process exit)bot;
Options
- node-xmpp-client's
rooms
: List of rooms{jid, nick}
the bot should join
Commands
Command functions are passed 4 arguments:
- answer: function that sends the provided text or XML element
- answer.broadcast: broadcast message to all rooms
- args: array of arguments
- state: an object that is saved for this command (
=env[command-name]
) - env: state shared by all commands
Commands are executed when a message sent to the bot starts with their name
or when the bot is mentioned with @nick <command> [args]
in a MUC (multi-user-chat)