#client token error

82 messages · Page 1 of 1 (latest)

weak roost
#

• 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.

#

this is my error

#

even if I put my bot's token there

#

It wont work

night wing
#

Dont know why youre showing internal code

#

Your token is wrong, nothing more to it

worldly inletBOT
#

Finding your bot token:
• Visit the application dashboard and select your application
• Navigate to the Bot tab (not General Information, not OAuth2)!
• Click Reset Token and copy token | https://i.imgur.com/c12eP0t.png (image)
Note: Remember to change the token in your application after you reset it

weak roost
#

I already put my token in

night wing
#

But its wrong

weak roost
#

but still says its invalid

night wing
#

Because it is

weak roost
#

it says 'string' is invalid

night wing
#

You've either put it in wrong, arent passing it to login correctly, or didnt copy the right thing

night wing
weak roost
night wing
#

Youre just copying internal source code

#

That doesnt help

#

Your token is invalid

#

Or the value you passed to client.login is not your token

weak roost
#

do I redo the whole part then?

#

the 'if (!token || typeof token !== 'string') throw new DiscordjsError(ErrorCodes.TokenInvalid);' part

night wing
#

Once again, stop copying internal discord.js source code

#

That's just telling you which line errors

#

That suggests that the value you passed is undefined, or otherwise not a string

weak roost
#

alright

#

im new to coding I might be asking stupid questions but

#

it doesnt identify client and discord

#

with discord.js on it

night wing
#

You probably now have syntax errors

#

For that identifier to be unexpected suggests the line above it doesnt end correctly

weak roost
#

ohh makes sense

night wing
#

Okay, show how you defined Discord

#

These cropped screenshots are not very helpful

weak roost
#

here

night wing
#

that actually looks fine. I have no idea

weak roost
#

oh..

night wing
#

youre still doing a fair bit of cropping though. Its possible theres other issues

weak roost
brisk dove
#

reset ur token

night wing
#

where the hell did you get all those imports from???

#

What file are you modifying here?

#

And yeah you need to reset your token, but at least now I can see why that didnt work - its not a string

#

Are you modifying discord.js internal files?

brisk dove
#

lmao don't tell me he is

weak roost
#

nah its a discord bot

night wing
#

Really?

brisk dove
#

are you sure because i see those same exact imports in Client.js of the source code

night wing
#

Yeah exactly

#

That looks exactly like you've deleted the actual discord.js Client file and replaced it with your own code

weak roost
#

no I'm honest I didn't code it actually I just needed help with those errors

night wing
#

Yeah we cant possibly help you

weak roost
#

I'm not sure what happened there'

night wing
#

We expect you to know how to code

#

This is the most wrong attempt I've seen in some time

weak roost
#

No I am a complete beginner

night wing
#

Then you arent going to be able to do this

weak roost
#

oh

brisk dove
#

😭 i would suggest reinstalling discord.js first to fix whatever you did to the source

weak roost
#

ill surely do lmao after I realise what I messed up

brisk dove
#

and make sure to reset ur token

weak roost
#

yeah I did

#

I just wanted to show the whole part to Monbrey

#

But the only thing that I think you can help me with guys

#

What's up with the token 'string'

night wing
#

No dude, we're so far beyond that issue now lol

weak roost
#

oh

#

alr then

worldly inletBOT
#

mdn String
The String object is used to represent and manipulate a sequence of characters.

night wing
#

You need to learn Javascript first

#

You wont be able to ask the right questions or understand our answers otherwise

broken hill
weak roost
#

yeah

#

alright guys

broken hill
#

i know, wasent clear to him tho. now it might be