#issue with code

1 messages · Page 1 of 1 (latest)

stoic osprey
#

I have this code and it's returning an error, I already checked by logging and message.member is defined, the error was also logged 3 times for some reason

Code: https://pastebin.com/WWMVCewy
Error:

latent barnBOT
#

To help others find answers, you can mark your question as solved via Right click solution message -> Apps -> ✅ Mark Solution

stoic osprey
#

idk if this helps but I logged message.member.roles.cache.has(moderation.modRole) and it returned false (3 times too)

lean ruin
stoic osprey
lean ruin
#

Is it always giving the error? Or just sometimes

#

I would say, to fix it, just replace message.member.roles.cache.has(moderation.modRole) with message.member?.roles.cache.has(moderation.modRole)

#

That will also account for if there isn't message.member for any reason

stoic osprey
#

i think I fixed it, it was just that it was detecting the bot's message too

#

still need to figure out the data problem, but this problem is fixed

latent barnBOT