user undefined
I am encounting following error:
TypeError: Cannot read properties of undefined (reading 'user')
Here is the code:
Any Ideas why?28 Replies
- What's your exact discord.js
npm list discord.js
and node node -v
version?
- Post the full error stack trace, not just the top part!
- Show your code!
- Explain what exactly your issue is.
- Not a discord.js issue? Check out #useful-servers.
- Issue solved? Press the button!nop
pretty sure my code is just ass lol
client.user
is not always availableI think I used
interaction.user
.use optional chaining
what?
@_thethe this is the solution, you can do this
oh sorry
I think I misunderstood the question
atleast it doesnt give me errors now š
the status still not changing š¤
client.user is undefined, try logging the client and check what's logging
You could also do something else
if
there's no client user foundoh yeah uh its undefined š¤
Unknown Userā¢2y ago
Message Not Public
Sign In & Join Server To View
lol
Unknown Userā¢2y ago
Message Not Public
Sign In & Join Server To View
then there's an issue in your params I guess, yeah you can do that ^
Unknown Userā¢2y ago
Message Not Public
Sign In & Join Server To View
Not related but Can I do something like this when some of functions are not in
interaction
?
yeah okay now its not undefined anymore
Unknown Userā¢2y ago
Message Not Public
Sign In & Join Server To View
ahhh now it works
yeah I think that makes sense
thanks
Unknown Userā¢2y ago
Message Not Public
Sign In & Join Server To View
yeah but I believe this works with
interaction.client
too.
Unknown Userā¢2y ago
Message Not Public
Sign In & Join Server To View
I mean
Unknown Userā¢2y ago
Message Not Public
Sign In & Join Server To View
yes
š