Allow /connect command to work on current network

This commit is contained in:
Pavel Djundik 2016-05-16 17:22:03 +03:00
parent 047a79ead6
commit a0010ca9f6

View File

@ -1,8 +1,24 @@
var Msg = require("../../models/msg");
exports.commands = ["connect", "server"];
exports.allowDisconnected = true;
exports.input = function(network, chan, cmd, args) {
if (args.length === 0) {
if (!network.irc || !network.irc.connection) {
return;
}
if (network.irc.connection.connected) {
chan.pushMessage(this, new Msg({
type: Msg.Type.ERROR,
text: "You are already connected."
}));
return;
}
network.irc.connection.connect();
return;
}