UNPKG

coffea

Version:

event based and extensible nodejs irc client library with multi-network support

27 lines (22 loc) 549 B
/** * ERRORS plugin to emit "errors" event. * * List of possible errors: * https://github.com/williamwicks/irc-replies/blob/master/replies.json#L113-L170 * * @return {Function} * @api public */ module.exports = function(){ return function(irc){ irc.on('data', function (err, msg) { if (msg.command.indexOf("ERR_") !== 0) { return; } var e = {}; e.cmd = msg.command; e.message = msg.trailing; irc.emit('errors', e); }); }; };