Rare Error
i entered into my main bot's console and this error was logged, I tried reproducing the error but I couldn't, everything was working fine, my best guess is that for some reason
<Message>.member
went undefined, any ideas?15 Replies
- What's your exact discord.js
npm list discord.js
and node node -v
version?
- Not a discord.js issue? Check out #other-js-ts.
- Consider reading #how-to-get-help to improve your question!
- Explain what exactly your issue is.
- Post the full error stack trace, not just the top part!
- Show your code!
- Issue solved? Press the button!Also some time ago I had this error, which was fixed by adding a
?
so it looks something like this message.author?.bot
Unknown User•9mo ago
Message Not Public
Sign In & Join Server To View
I tried recreating it as well, but no luck
yeah obviously
Unknown User•9mo ago
Message Not Public
Sign In & Join Server To View
could it be a host issue?
i keep trying to recreate it on the testing bot but no errors are logged
Unknown User•9mo ago
Message Not Public
Sign In & Join Server To View
the error says the member is null, not undefined
the member can be missing whenever the message is sent outside of a server
i have an
!message.guild
check
yeah its defined
I haven't been able to recreate it, the errors just appear randomlyUnknown User•9mo ago
Message Not Public
Sign In & Join Server To View
as a Message object
also these random errors only happen in the main bot, have been trying to recreate them on the testing bot but no luck
and before someone asks, yes they both have the same code
this error was fixed by adding a optional chain, my best guess is that for some reason
<Message>.author
went null
I have also tried to recreate them in the main bot, but no luck aswellthe author can be null if the updated message was not originally cached
Are you checking the old member or the new member? Unless you explicitly need the old member's permissions, you should try and use the new data as much as possible
something something, "partials" behavior
wdym? the
isStaff
function is from the automod, not message log
i have a if check for that
here's my partials:
partials: [Partials.Message, Partials.Channel],
I know, but you're passing in one of the
<Message>.member
instances to isStaff()
so you should prioritize newMessage.member
rather than oldMesasge.member
if possibleim not using
isStaff
anywhere on the message log
I will change my if check on the automod file from if (!message.guild || message.author?.bot || isStaff(message.member)) return;
to if (!message?.member || message.author.bot || isStaff(message.member)) return;
to hopefully fix these errors
as I said i cannot reproduce these errors so i will need to wait a few days to see if they appear on console
newMsg
i just implemented this in the main bot, will come back if the errors appear again