Ask coding questions

← Back to all posts
Client isn’t defined discord.js

So uh I have a discord.js bot, and I defined client on the top of the page but for some reason client isn’t defining. In my other files I use bot, but that shouldn’t matter.


Were you repeating the same variable that had "new Discord.Client()" for all your files?

If you did,then that's the issue. You should only create one client in your main file (index.js,main.js,whatever yours is) and then require it from that main file for other files.

If this sounded confusing,just search it up. I am confident your answer will be in the first result.


is it libs