From 46190eb580e8b7d5f351875b010dc9f77100d738 Mon Sep 17 00:00:00 2001 From: Caleb Fontenot Date: Fri, 31 Mar 2023 12:33:50 -0500 Subject: [PATCH] First working build:tm: --- main.ts | 8 +++++++- 1 file changed, 7 insertions(+), 1 deletion(-) 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);