2014-09-13 17:29:45 -04:00
|
|
|
var _ = require("lodash");
|
2016-03-20 12:34:36 -04:00
|
|
|
var Msg = require("../../models/msg");
|
2014-09-13 17:29:45 -04:00
|
|
|
|
2016-03-14 00:21:42 -04:00
|
|
|
exports.commands = ["close", "leave", "part"];
|
2016-03-06 04:24:56 -05:00
|
|
|
|
2016-03-14 00:21:42 -04:00
|
|
|
exports.input = function(network, chan, cmd, args) {
|
2016-03-20 12:34:36 -04:00
|
|
|
if (chan.type === "lobby") {
|
|
|
|
this.emit("msg", {
|
|
|
|
chan: chan.id,
|
|
|
|
msg: new Msg({
|
|
|
|
type: Msg.Type.ERROR,
|
|
|
|
text: "You can not part from networks, use /quit instead."
|
|
|
|
})
|
|
|
|
});
|
|
|
|
return;
|
|
|
|
}
|
|
|
|
|
|
|
|
if (chan.type === "channel") {
|
2014-09-13 17:29:45 -04:00
|
|
|
var irc = network.irc;
|
|
|
|
if (args.length === 0) {
|
|
|
|
args.push(chan.name);
|
|
|
|
}
|
|
|
|
irc.part(args);
|
|
|
|
}
|
2016-03-06 04:24:56 -05:00
|
|
|
|
2016-02-14 05:08:38 -05:00
|
|
|
network.channels = _.without(network.channels, chan);
|
|
|
|
this.emit("part", {
|
|
|
|
chan: chan.id
|
|
|
|
});
|
2016-03-06 04:24:56 -05:00
|
|
|
|
|
|
|
return true;
|
2014-09-13 17:29:45 -04:00
|
|
|
};
|