thelounge/src/plugins/inputs/quit.js
Pavel Djundik a3e448acf5 Enable no-var rule
Fixes #1961
2018-02-19 19:49:39 +02:00

26 lines
520 B
JavaScript

"use strict";
const _ = require("lodash");
const Helper = require("../../helper");
exports.commands = ["quit"];
exports.allowDisconnected = true;
exports.input = function(network, chan, cmd, args) {
const client = this;
client.networks = _.without(client.networks, network);
network.destroy();
client.save();
client.emit("quit", {
network: network.id,
});
if (network.irc) {
const quitMessage = args[0] ? args.join(" ") : Helper.config.leaveMessage;
network.irc.quit(quitMessage);
}
return true;
};