#discord bot hosting issue

45 messages · Page 1 of 1 (latest)

echo stirrup
#

Hi, could you please provide the error that is shown in console?

plush tendon
#

06 01:59:20 [Bot] [2023/06/03 02:59:20] Unhandled promise rejection: Error [TokenInvalid]: An invalid token was provided.
03.06 01:59:20 [Bot] at Client.login (/node_modules/discord.js/src/client/Client.js:214:52)
03.06 01:59:20 [Bot] at /src/index.js:183:16 {
03.06 01:59:20 [Bot] code: 'TokenInvalid'
03.06 01:59:20 [Bot] }

sacred spruce
#

Is it in a environmental variable

echo stirrup
plush tendon
compact bisonBOT
#

@plush tendon, you just advanced to level 1 !

echo stirrup
#

I personally like sending my token to the bot's dms

#

Therefore I never need to reset it or lose it

#

Just reset it, it won't hurt anyone, make sure you save it somewhere safe, such as the bot's dms

plush tendon
#

Tried it already

#

I can try again

echo stirrup
#

Are you using .env or a config file?

plush tendon
#

configure envirnment

echo stirrup
#

Could you try logging in with the token provided straight into the brackets, make sure the token is a string

plush tendon
#

.env

echo stirrup
#

Try to log in just normally without .env, put the token straight into the brackets, check if that works to make sure your token is valid

#

If it works then the error is with your .env and we can have a further look into it

sacred spruce
#

Just put ur token directly into the program

#

No one can see ur token or files

plush tendon
#

still

#

same error

#

Tried new token

echo stirrup
#

Did you do client.login("token")

plush tendon
#

where

#

env?

echo stirrup
#

No env

#

Just straight up do client.login("token")

plush tendon
#

wdym

echo stirrup
#

Put the token straight into the brackets

#

Inside a string

#

Don't use .env for a minute so we can see if the issue is ur token or .env

plush tendon
#

straight into the brackets? ok

#

but where

echo stirrup
#

Inside your main file

plush tendon
#

its working fine but thats really weird, env worked fine before

#

only issue with env that I had is on this hosting rn

echo stirrup
#

.env can act differently in a different server enviroment

sacred spruce
plush tendon
#

oh

sacred spruce
#

Sometimes

#

U have to do it a specific way

#

Easier to just put it in

plush tendon
#

ok