diff --git a/main.ts b/main.ts index ee64a80..64389b8 100644 --- a/main.ts +++ b/main.ts @@ -109,7 +109,13 @@ client.on('messageCreate', message => { console.log("Found abbreviation: " + abbr); console.log("Phrase that matches used acronym: " + phrase); - var rebuildMessageArray = message.content.split(new RegExp(abbr, 'i')); + if (abbr !== "") { + var rebuildMessageArray = message.content.split(new RegExp(abbr, 'i')); + } else { + message.reply("Detected abbreviation, but regex matching broke. Caleb is working on this..."); + break; + } + arrayRotate(rebuildMessageArray, true, 1); rebuildMessageArray.unshift(phrase); arrayRotate(rebuildMessageArray, true, 2);