Invalid token
I'm trying to setup the .env file but whenever I try to run the bot its saying invalid token. I've reset the token and put the new token in but still the same error. Am I coding it wrong?



42 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!
- ✅
Marked as resolved by OPUnknown User•11mo ago
Message Not Public
Sign In & Join Server To View
crap it was. But even when I changed it
I'm still getting the TokenInvalid error
Unknown User•11mo ago
Message Not Public
Sign In & Join Server To View
They are
Unknown User•11mo ago
Message Not Public
Sign In & Join Server To View
huh?

Unknown User•11mo ago
Message Not Public
Sign In & Join Server To View
I cant get it to output anything to console.

Unknown User•11mo ago
Message Not Public
Sign In & Join Server To View
Yes.
Unknown User•11mo ago
Message Not Public
Sign In & Join Server To View
Sure my bad.



Unknown User•11mo ago
Message Not Public
Sign In & Join Server To View
I changed it to test

Unknown User•11mo ago
Message Not Public
Sign In & Join Server To View
yes
Unknown User•11mo ago
Message Not Public
Sign In & Join Server To View
I reset my token now I'm getting this error ( I'm changing my token after don't worry).
Unknown User•11mo ago
Message Not Public
Sign In & Join Server To View
right after I did = require discord.js
fixed that red error
Just cant get the invalid token
Unknown User•11mo ago
Message Not Public
Sign In & Join Server To View
I moved it into the client.on function
to see if it logs
Unknown User•11mo ago
Message Not Public
Sign In & Join Server To View
True.
Unknown User•11mo ago
Message Not Public
Sign In & Join Server To View
I put it right before but it's still not logging anything
Unknown User•11mo ago
Message Not Public
Sign In & Join Server To View
Here is fine right?

Unknown User•11mo ago
Message Not Public
Sign In & Join Server To View
yea it does not log anything
Unknown User•11mo ago
Message Not Public
Sign In & Join Server To View
odd because it was running before I tried setting up the .env file with the token
everything worked but as soon as I moved the bot token to .env and tried to register it
it just stoped working
Unknown User•11mo ago
Message Not Public
Sign In & Join Server To View

Unknown User•11mo ago
Message Not Public
Sign In & Join Server To View
Yea I just tried that
It works
so its the registering the .env var for the bot token that is erroring
Which is weird.
If you come up with a idea why this is erroring please let me know! But thanks for helping.
Unknown User•11mo ago
Message Not Public
Sign In & Join Server To View
OK no problem! Thanks for the help