issue with code

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:
Solution:
didn't work, it ran the console.log twice and the error was thrown 3 times
Jump to solution
7 Replies
-Carlosđź‘‘
-Carlos👑•8mo ago
idk if this helps but I logged message.member.roles.cache.has(moderation.modRole) and it returned false (3 times too)
Lioness100
Lioness100•8mo ago
message.member will be undefined in DMs
-Carlosđź‘‘
-Carlos👑•8mo ago
im running it on a guild
Lioness100
Lioness100•8mo ago
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
Solution
-Carlosđź‘‘
-Carlos👑•8mo ago
didn't work, it ran the console.log twice and the error was thrown 3 times
-Carlosđź‘‘
-Carlos👑•8mo ago
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
-Carlosđź‘‘
-Carlos👑•8mo ago
marked wrong message oops