A better IRC framework for node.js. For bots and full clients. Read the documentation.
- Lightweight
- Performant
- Very easy to get going out of the box
- Grows as needed for larger applications
- IRCv3 compliant
- Multiple (+ auto detected) encoding support
- Complete test suite
varbot=newIRC.Client();bot.connect({host: 'irc.freenode.net',port: 6667,nick: 'prawnsbot'});bot.on('message',function(event){if(event.message.indexOf('hello')===0){event.reply('Hi!');}if(event.message.match(/^!join/)){varto_join=event.message.split(' ')[1];event.reply('Joining '+to_join+'..');bot.join(to_join);}});// Or a quicker to match messages...bot.matchMessage(/^hi/,function(event){event.reply('hello there!');});varbot=newIRC.Client();bot.connect({host: 'irc.freenode.net',port: 6667,nick: 'prawnsbot'});varbuffers=[];bot.on('registered',function(){varchannel=bot.channel('#prawnsalad');buffers.push(channel);channel.join();channel.say('Hi!');channel.updateUsers(function(){console.log(channel.users);});// Or you could even stream the channel messages elsewherevarstream=channel.stream();stream.pipe(process.stdout);});functionExampleMiddleware(){returnfunction(client,raw_events,parsed_events){parsed_events.use(theMiddleware);}functiontheMiddleware(command,event,client,next){if(command==='registered'){if(client.options.nickserv){varoptions=client.options.nickserv;client.say('nickserv','identify '+options.account+' '+options.password);}}if(command==='message'&&client.caseCompare(event.event.nick,'nickserv')){// Handle success/retries/failures}next();}}varirc_bot=newIRC.Client();irc_bot.use(ExampleMiddleware());