thelounge/lib/plugins/inputs/part.js
2014-07-07 02:44:31 +02:00

20 lines
440 B
JavaScript

var _ = require("lodash");
module.exports = function(network, chan, cmd, args) {
if (cmd != "part" && cmd != "leave" && cmd != "close") {
return;
}
var client = this;
if (chan.type == "query") {
network.channels = _.without(network.channels, chan);
client.emit("part", {
chan: chan.id
});
} else {
var irc = network.irc;
if (args.length === 0) {
args.push(chan.name);
}
irc.part(args);
}
};