circl
is a concise IRC client library for node.js. It provides almost nothing except for a basic environment to connect to an IRC server and channels, you build upon it using triggers that call functions.
Installation
npm install circl
Basic implementation
circl = require("./lib/circl.js");
irc = new circl.IRCClient(nick, mode, [ channel, channel ], host, port, log);
irc.connect(irc.socket);
Triggers
User specified triggers can be added by using irc.addTrigger
. Here's an example of a trigger that sends a message to the console when a ping is received:
irc.addTrigger(/^PING (.+)/, function(groups) {
console.log("Ping with message " + groups[1]);
});
Logging
When the log
argument evaluates to true, transactions are logged. You can separate outgoing data from incoming data by the stream it is using; data from the client (i.e. you) is on STDERR, data from the server is on STDOUT.