hardlounge/src/plugins/inputs/quit.js
2017-08-24 21:07:47 +03:00

26 lines
515 B
JavaScript

"use strict";
var _ = require("lodash");
const Helper = require("../../helper");
exports.commands = ["quit"];
exports.allowDisconnected = true;
exports.input = function(network, chan, cmd, args) {
var 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;
};