Add check to make sure response is under 2000 characters

master
Chloe Fontenot 🏳️‍⚧️ 2023-04-04 16:28:07 +07:00
parent 32f84f6e08
commit 81e1b562e8
1 changed files with 6 additions and 1 deletions

@ -94,12 +94,17 @@ 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"
}
message.reply({content: "Your message contains " + plural + "! Let me fix that for you: \n > " + correctedMessage + "\n \n \|\|btw I was written by Caleb Fontenot\|\|", allowedMentions: { repliedUser: false }});
if (stringLength > 2000) {
replyString = "Sorry, I detected " + plural + "but the resultant response was " + stringLength + " characters long, and Discord only allows a maximum of 2000."
}
message.reply({content: replyString, allowedMentions: { repliedUser: false }});
}