From 02a765d8060c25e32c59dcddbb5d8dd07bb64bad Mon Sep 17 00:00:00 2001 From: Caleb Fontenot Date: Tue, 4 Apr 2023 18:01:12 -0500 Subject: [PATCH] That if statement needs to be before its usage in replyString --- main.ts | 5 +++-- 1 file changed, 3 insertions(+), 2 deletions(-) diff --git a/main.ts b/main.ts index aec0d36..1eed445 100644 --- a/main.ts +++ b/main.ts @@ -94,13 +94,14 @@ function matchAbbr(abbrTarget) { function replyMessage(message, correctedMessage, abbrsUsed) { var plural = ""; - var replyString = "Your message contains " + plural + "! Let me fix that for you: \n > " + correctedMessage + "\n \n \|\|btw I was written by Caleb Fontenot\|\|" - var stringLength = replyString.length; if (abbrsUsed == 1) { plural = "an acronym"; } else { plural = abbrsUsed + " acronyms" } + var replyString = "Your message contains " + plural + "! Let me fix that for you: \n > " + correctedMessage + "\n \n \|\|btw I was written by Caleb Fontenot\|\|" + var stringLength = replyString.length; + if (stringLength > 2000) { replyString = "Sorry, I detected " + plural + ", but the resultant response was " + stringLength + " characters long, and Discord only allows a maximum of 2000." }