[TS] message member is possibly null

making something that uses message.member to check permissions of a user npm v.9.6.7 node v.18.3.0 discord.js v14.11.0
8 Replies
d.js toolkit
d.js toolkit16mo ago
- 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!
space
space16mo ago
Use author instead, that property always exist on newly received messages.
doqe
doqeOP16mo ago
doqe
doqeOP16mo ago
the 2nd screenshot is when the function is specifically using message.user
space
space16mo ago
Now this function, whatever it actually is doing, wants a member, giving it a user won't work. If this really requires a member, you might want to fetch the member in case it's missing. Note that webhook messages do not come with one and you won't be able to fetch one.
Unknown User
Unknown User16mo ago
Message Not Public
Sign In & Join Server To View
d.js docs
d.js docs16mo ago
method Message#inGuild() Whether this message is from a guild.
Unknown User
Unknown User16mo ago
Message Not Public
Sign In & Join Server To View
Want results from more Discord servers?
Add your server