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:40:04 -05:00
parent dd9548cf18
commit 81bdab6bbc

View File

@ -126,16 +126,16 @@ function checkMessage(message) {
for (let i = 0; i < matchMessageArray.length; ++i) { for (let i = 0; i < matchMessageArray.length; ++i) {
var rebuildMessageArray = []; var rebuildMessageArray = [];
//console.log("Corrected Message: " + correctedMessage); //console.log("Corrected Message: " + correctedMessage);
if (!message.author.bot) {
if (abbreviationKey.target_phrases[matchMessageArray[i]] !== undefined) { if (abbreviationKey.target_phrases[matchMessageArray[i]] !== undefined) {
console.log("Has role? " + message.member.roles.cache.some(role => role.name == "Exempt from NoMoreAcronyms")); console.log("Has role? " + message.member.roles.cache.some(role => role.name == "Exempt from NoMoreAcronyms"));
if (!message.author.bot) {
if (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('🇴'); message.react('🇴');
message.react('🇬'); message.react('🇬');
return; return;
} }
}
} }
matchDetected = true; matchDetected = true;
abbrsUsed++; abbrsUsed++;