diff --git a/main.ts b/main.ts index 6ec5d2a..41f0cc9 100644 --- a/main.ts +++ b/main.ts @@ -104,10 +104,12 @@ client.on('messageCreate', message => { var matchMessageArray = message.content.toLowerCase().split(/[ ,!@#$%^&*()]+/); console.log(matchMessageArray); - var correctedMessage = message.content; - + let correctedMessage = message.content; + let matchDetected = false; for (let i = 0; i < matchMessageArray.length; ++i) { + console.log("Corrected Message: " + correctedMessage); if (abbreviationKey.target_phrases[matchMessageArray[i]] !== undefined) { + matchDetected = true; //Return key var phrase = abbreviationKey.target_phrases[matchMessageArray[i]]; var abbr = matchAbbr(phrase); //abbreviationKey.target_phrases[phrase]; @@ -136,6 +138,9 @@ client.on('messageCreate', message => { //break; } } - replyMessage(message, correctedMessage); + if (matchDetected) { + replyMessage(message, correctedMessage); + } + } );