thelounge/src/plugins/inputs/quit.js

26 lines
516 B
JavaScript
Raw Normal View History

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