I am getting random undefined errors? something is wrong with discord.js
I need some help with this.
12 Replies
• 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.─ [email protected]
client.once(event.name, (...args) => event.execute(...args, client));
^
TypeError: Cannot read properties of undefined (reading 'once')
I literally have had this code forever
inside my bot
and now it started erroring out for no reason
like what
I made a new bot just to test this theory and error out
and i was correct
it just errors out for no reason
What's your event file look like?
dont have an event file
i have a file in events/client/ready.js
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
You never passed client to the loadEvents method, so of course you get that error.
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