From 846a346ad9430b9afa8ad510fd25c9f3043bdc35 Mon Sep 17 00:00:00 2001 From: Caleb Fontenot Date: Sun, 2 Apr 2023 15:37:01 -0500 Subject: [PATCH] Don't try to check roles if message came from a bot (or webhook, they both return true for that flag) --- main.ts | 17 +++++++++-------- 1 file changed, 9 insertions(+), 8 deletions(-) diff --git a/main.ts b/main.ts index fa59178..fc53f49 100644 --- a/main.ts +++ b/main.ts @@ -127,15 +127,16 @@ function checkMessage(message) { var rebuildMessageArray = []; //console.log("Corrected Message: " + correctedMessage); if (!message.author.bot) { - if (abbreviationKey.target_phrases[matchMessageArray[i]] !== undefined) { - console.log("Has role? " + message.member.roles.cache.some(role => role.name == "Exempt from NoMoreAcronyms")); - if (message.member.roles.cache.some(role => role.name == "Exempt from NoMoreAcronyms")) { - message.react('🇵'); - message.react('🇴'); - message.react('🇬'); - return; - } + if (abbreviationKey.target_phrases[matchMessageArray[i]] !== undefined) { + console.log("Has role? " + message.member.roles.cache.some(role => role.name == "Exempt from NoMoreAcronyms")); + if (message.member.roles.cache.some(role => role.name == "Exempt from NoMoreAcronyms")) { + message.react('🇵'); + message.react('🇴'); + message.react('🇬'); + return; + } } + } matchDetected = true; abbrsUsed++; //Return key