From 5bde32f7fe6a17277db24e284d10c6eac4988af4 Mon Sep 17 00:00:00 2001 From: Matthew Hodgson Date: Fri, 13 May 2016 17:07:27 +0100 Subject: [PATCH] handle slashcommands with no args --- src/SlashCommands.js | 10 ++++++++-- 1 file changed, 8 insertions(+), 2 deletions(-) diff --git a/src/SlashCommands.js b/src/SlashCommands.js index fcdd33474e..5a43d41dd5 100644 --- a/src/SlashCommands.js +++ b/src/SlashCommands.js @@ -335,8 +335,14 @@ module.exports = { input = input.replace(/\s+$/, ""); if (input[0] === "/" && input[1] !== "/") { var bits = input.match(/^(\S+?)( +(.*))?$/); - var cmd = bits[1].substring(1).toLowerCase(); - var args = bits[3]; + var cmd, args; + if (bits) { + cmd = bits[1].substring(1).toLowerCase(); + args = bits[3]; + } + else { + cmd = input; + } if (cmd === "me") return null; if (aliases[cmd]) { cmd = aliases[cmd];