2016-10-09 21:14:02 +02:00
|
|
|
"use strict";
|
|
|
|
|
2018-01-11 12:33:36 +01:00
|
|
|
const _ = require("lodash");
|
2014-09-13 23:29:45 +02:00
|
|
|
|
2016-04-14 10:56:02 +02:00
|
|
|
exports.commands = ["quit"];
|
2016-04-03 11:58:59 +02:00
|
|
|
exports.allowDisconnected = true;
|
2015-10-01 00:39:57 +02:00
|
|
|
|
2020-03-21 21:55:36 +01:00
|
|
|
exports.input = function (network, chan, cmd, args) {
|
2018-01-11 12:33:36 +01:00
|
|
|
const client = this;
|
2015-10-01 00:39:57 +02:00
|
|
|
|
2014-09-13 23:29:45 +02:00
|
|
|
client.networks = _.without(client.networks, network);
|
2017-08-11 14:02:58 +02:00
|
|
|
network.destroy();
|
2014-10-12 01:59:01 +02:00
|
|
|
client.save();
|
2014-09-13 23:29:45 +02:00
|
|
|
client.emit("quit", {
|
2018-04-26 11:06:01 +02:00
|
|
|
network: network.uuid,
|
2014-09-13 23:29:45 +02:00
|
|
|
});
|
2015-10-01 00:39:57 +02:00
|
|
|
|
2020-02-19 13:09:22 +01:00
|
|
|
const quitMessage = args[0] ? args.join(" ") : null;
|
|
|
|
network.quit(quitMessage);
|
2016-03-06 10:24:56 +01:00
|
|
|
|
|
|
|
return true;
|
2014-09-13 23:29:45 +02:00
|
|
|
};
|