'client.user' is possible null
The error that VS Code gives me is in the title.
Can someone help me?
I'm a newbie in TypeScript btw.
[email protected]
nodejs v18.15.0
18 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.Unknown User•2y ago
Message Not Public
Sign In & Join Server To View
Like
I'm Calling the
setActivity()
function in the ClientReady event btw.
I'm getting the same errorUnknown User•2y ago
Message Not Public
Sign In & Join Server To View
Yeah but client is not defined inside that function.
Console log client when u call the function
Unknown User•2y ago
Message Not Public
Sign In & Join Server To View
Client#isReady()
Returns whether the client has logged in, indicative of being able to access properties such as
user
and application
.Unknown User•2y ago
Message Not Public
Sign In & Join Server To View
bruh
Unknown User•2y ago
Message Not Public
Sign In & Join Server To View
Their is some more code thats private for getting the Presence of an Json file
because of this i have to use it in a function
Unknown User•2y ago
Message Not Public
Sign In & Join Server To View
It's just an example
Unknown User•2y ago
Message Not Public
Sign In & Join Server To View
Their is normally an json array
Unknown User•2y ago
Message Not Public
Sign In & Join Server To View
return?
oh right
I missed it xD
But now it works fine. I didnt know that ts and VS Code will look at stuff like this
Unknown User•2y ago
Message Not Public
Sign In & Join Server To View