2016-10-09 19:14:02 +00:00
|
|
|
"use strict";
|
|
|
|
|
2014-09-13 21:29:45 +00:00
|
|
|
var _ = require("lodash");
|
2017-08-18 19:04:16 +00:00
|
|
|
const Helper = require("../../helper");
|
2014-09-13 21:29:45 +00:00
|
|
|
|
2016-04-14 08:56:02 +00:00
|
|
|
exports.commands = ["quit"];
|
2016-04-03 09:58:59 +00:00
|
|
|
exports.allowDisconnected = true;
|
2015-09-30 22:39:57 +00:00
|
|
|
|
2016-03-14 04:21:42 +00:00
|
|
|
exports.input = function(network, chan, cmd, args) {
|
2014-09-13 21:29:45 +00:00
|
|
|
var client = this;
|
2015-09-30 22:39:57 +00:00
|
|
|
|
2014-09-13 21:29:45 +00:00
|
|
|
client.networks = _.without(client.networks, network);
|
2017-08-11 12:02:58 +00:00
|
|
|
network.destroy();
|
2014-10-11 23:59:01 +00:00
|
|
|
client.save();
|
2014-09-13 21:29:45 +00:00
|
|
|
client.emit("quit", {
|
|
|
|
network: network.id
|
|
|
|
});
|
2015-09-30 22:39:57 +00:00
|
|
|
|
2017-08-18 19:04:16 +00:00
|
|
|
if (network.irc) {
|
|
|
|
const quitMessage = args[0] ? args.join(" ") : Helper.config.leaveMessage;
|
|
|
|
network.irc.quit(quitMessage);
|
2016-04-03 09:58:59 +00:00
|
|
|
}
|
2016-03-06 09:24:56 +00:00
|
|
|
|
|
|
|
return true;
|
2014-09-13 21:29:45 +00:00
|
|
|
};
|