hardlounge/src/plugins/inputs/quit.js

22 lines
403 B
JavaScript
Raw Normal View History

2014-09-13 17:29:45 -04:00
var _ = require("lodash");
module.exports = function(network, chan, cmd, args) {
2015-09-30 18:39:57 -04:00
if (cmd !== "quit" && cmd !== "disconnect") {
2014-09-13 17:29:45 -04:00
return;
}
2015-09-30 18:39:57 -04:00
2014-09-13 17:29:45 -04:00
var client = this;
var irc = network.irc;
var quitMessage = args[0] ? args.join(" ") : "";
2015-09-30 18:39:57 -04:00
2014-09-13 17:29:45 -04:00
client.networks = _.without(client.networks, network);
2014-10-11 19:59:01 -04:00
client.save();
2014-09-13 17:29:45 -04:00
client.emit("quit", {
network: network.id
});
2015-09-30 18:39:57 -04:00
irc.quit(quitMessage);
2016-03-06 04:24:56 -05:00
return true;
2014-09-13 17:29:45 -04:00
};