client is not defined in interactionCreate.js, but it is defined in main.js
If im not wrong, i dont have to defind it again ;=;
![](https://cdn.answeroverflow.com/1128969316457521162/image.png)
![](https://cdn.answeroverflow.com/1128969316692410418/image.png)
72 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.I thank your cooldown system should be inside your interactionCreate listener
well, it is
its in interactionCreate
but i cant start main.js
it is not, you destructure it from client, but you never declare client outside of your execute loop
so destructure inside your execute loop, and destructure from interaction.client
so, i just have to put it in main.js if im getting you right ?
no
destructure inside your interactionCreate loop
You can leave client.cooldowns defined in your main file
But you have to access it from the client in your execute loop
Agh, i dont know how to explain, the only thing in main.js is client.cooldowns, the rest of stuff is in interactionCreate
You can do the cooldown logic in your main.js yes, but you cant magically destructure it from a nonexistent property
Well, i just did all like the guide says, i put client.cooldowns = new Collection(); in main.js and other stuff i put in interactionCreate.js
I cant put it in there, bc its already there
the idea is you can't just put it in the file
interactionCreate.js
it's not just the code's presence in the file that makes it execute when the event is received
the execute
function is what executes when the event is received
the erroring code is currently outside this function
currently it will also presumably execute immediately before the bot even logs inso, uhh, what should i do ?
i have to make it start along with the bot or what ?
no, you need to move the code for handling command cooldowns where you actually handle commands: inside the
execute
functionso, i have to put some part of code into main.js, the file i execute ?
right ?
no
a