diff --git a/client/js/commands/join.js b/client/js/commands/join.js index 22b6b8dd..114840ca 100644 --- a/client/js/commands/join.js +++ b/client/js/commands/join.js @@ -3,18 +3,22 @@ const $ = require("jquery"); exports.input = function(args) { - const channel = args[0]; const utils = require("../utils"); const socket = require("../socket"); const {vueApp} = require("../vue"); - if (channel) { - const chan = utils.findCurrentNetworkChan(channel); + if (args.length > 0) { + const channel = args[0]; - if (chan) { - $(`#sidebar .chan[data-id="${chan.id}"]`).trigger("click"); + if (channel.length > 0) { + const chan = utils.findCurrentNetworkChan(channel); + + if (chan) { + $(`#sidebar .chan[data-id="${chan.id}"]`).trigger("click"); + } } } else if (vueApp.activeChannel.channel.type === "channel") { + // If `/join` command is used without any arguments, re-join current channel socket.emit("input", { target: vueApp.activeChannel.channel.id, text: `/join ${vueApp.activeChannel.channel.name}`,