UNPKG

squelch-client

Version:
54 lines (50 loc) 1.49 kB
// Generated by CoffeeScript 1.10.0 (function() { var getSender; getSender = require('../../util').getSender; module.exports = function() { return function(client) { client.kick = function(chan, user, reason) { var c, chans, i, len, results, u, users; chans = [].concat(chan); users = [].concat(user); if (reason != null) { reason = ' :' + reason; } else { reason = ''; } results = []; for (i = 0, len = chans.length; i < len; i++) { c = chans[i]; results.push((function() { var j, len1, results1; results1 = []; for (j = 0, len1 = users.length; j < len1; j++) { u = users[j]; results1.push(this.raw("KICK " + c + " " + u + reason)); } return results1; }).call(this)); } return results; }; return client._.internalEmitter.on('raw', function(reply) { var chan, kicker, me, nick, reason; if (reply.command === 'KICK') { kicker = getSender(reply); chan = reply.params[0]; nick = reply.params[1]; reason = reply.params[2]; me = nick === client.nick(); return client.emit('kick', { chan: chan, nick: nick, kicker: kicker, reason: reason, me: me }); } }); }; }; }).call(this);