Name courtesy of @isaacs.
An IRC library which I like.
var ircb = require('ircb');
var irc = ircb({
host: 'irc.freenode.org',
secure: true,
nick: 'mycoolbot',
username: 'mycoolbot',
realName: 'mycoolbot',
channels: ['#node.js'] // optional
}, function () {
console.log('Connected');
console.log('MOTD:\n');
console.log(irc.motd);
});
irc.join('#node.js', function (err) {
if (err) throw err;
console.log('Joined #node.js');
});
irc.say('#node.js', 'hello world');
irc.say('mmalecki', 'hello world');
irc.names('#node.js', function (err, names) {
if (err) throw err;
console.log('There are ' + names.length + ' people in #node.js channel');
});
options
(Object
)options.host
(string
) - host to connect tooptions.port
(number
, default:options.secure ? 6697 : 6667
) - port to connect tooptions.secure
(boolean
, default:false
) - use TLS?options.rejectUnauthorized
(boolean
, default:false
) - reject unauthorized certificates when using TLSoptions.nick
(string
, required) - IRC nickoptions.password
(string
) - IRC passwordoptions.username
(string
) - IRC usernameoptions.realName
(string
) - IRC real nameoptions.channels
(array
ofstring
, default:[]
) - channels to join. If specified, callscallback
after joining all the channels.
callback
(function
) - called after connecting to IRC, identifying and joining all the channels specified
ircb
returns an event emitter which returns following events:
register
- called when instance is connected, identified and joined all the specified channelserror(err)
- called when an error occurednames(channel, names)
- called when a list of names forchannel
is received