Don't try to check roles if message came from a bot (or webhook, they both return true for that flag)

This commit is contained in:
Chloe Fontenot 🏳️‍⚧️ 2023-04-02 15:37:01 -05:00
parent 461ce43594
commit 846a346ad9

17
main.ts
View File

@ -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