I am getting random undefined errors? something is wrong with discord.js

I need some help with this.
12 Replies
d.js toolkit
d.js toolkit2y ago
• 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.
mert
mertOP2y ago
[email protected] client.once(event.name, (...args) => event.execute(...args, client)); ^ TypeError: Cannot read properties of undefined (reading 'once')
mert
mertOP2y ago
mert
mertOP2y ago
I literally have had this code forever inside my bot and now it started erroring out for no reason like what
mert
mertOP2y ago
mert
mertOP2y ago
I made a new bot just to test this theory and error out and i was correct it just errors out for no reason
It's Manny
It's Manny2y ago
What's your event file look like?
mert
mertOP2y ago
dont have an event file i have a file in events/client/ready.js
mert
mertOP2y ago
mert
mertOP2y ago
Well i thought so, since i have used this eventhandler code for eternity, copied everything for it and made a new folder bot to see if the error was with something in my main bot
chewie
chewie2y ago
You never passed client to the loadEvents method, so of course you get that error.
mert
mertOP2y ago
client.login(client.config.token).then(() => { loadEvents(); }); Ok you guys are right my bad, I just got a bit confused since this "undefined error" keeps happening lol. I've had like 3-4 errors popup from code i've coded so long ago made me think something wrong today loadEvents(client); yes eh, sure Thanks btw i missed the question mark at the end of discord.js? i didnt make an statement taht something was wrong i was asking sry if it came out a bit yk Alright anyways, I will come back here if i get some more undefined errors popup true
Want results from more Discord servers?
Add your server