Skip to content

Instantly share code, notes, and snippets.

@tomyan
Created November 1, 2011 22:50
Show Gist options
  • Save tomyan/1332201 to your computer and use it in GitHub Desktop.
Save tomyan/1332201 to your computer and use it in GitHub Desktop.
irc client library interface
var circus = require('../lib/circus');
var channel = process.argv[2];
if (! channel) {
console.log('channel reqired');
process.exit(1);
}
var client = new circus.Client;
client.connect('nobot', 'irc.freenode.net').then(function (connection) {
connection.signals.messaged.add(function (message, agent) {
agent.sendMessage('no');
});
connection.join(channel).then(function (channel) {
channel.signals.messaged.add(function (message, agent, channel) {
if (message = connection.messageAddressedToMe(message)) {
channel.sendMessage(agent.nick + ': no');
}
});
});
});
Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment