Help building a cooldown for my slash commands

I need help building a global cooldown for my slash commands, I followed the discord.js guide partially and it somewhat works, although my commands are still sometimes going through, despite the cooldown being active. Any advice would be much appreciated.
4 Replies
d.js toolkit
d.js toolkit3w ago
- What's your exact discord.js npm list discord.js and node node -v version? - Not a discord.js issue? Check out #other-js-ts. - Consider reading #how-to-get-help to improve your question! - Explain what exactly your issue is. - Post the full error stack trace, not just the top part! - Show your code! - Issue solved? Press the button!
Stranger
StrangerOP3w ago
Here's the console logs, i dont have any errors unfortunately, none are appearing Command attempt: profile by user 484526479770910728 Creating new cooldown collection for profile Setting cooldown for 484526479770910728 on profile Executing command profile Command attempt: profile by user 484526479770910728 Blocking command - cooldown active (7.9s remaining) Failed to send cooldown message Command attempt: profile by user 484526479770910728 Blocking command - cooldown active (5.5s remaining) [email protected], node v20.18.0
d.js docs
d.js docs3w ago
To share long code snippets, use a service like gist, sourcebin, pastebin, or similar instead of posting them as large code blocks or files.
strangealmond
strangealmond3w ago
unsure if it's what's causing the problem, but i would convert that settimeout for removing the cooldown into an else statement after the if statement on line 218 for blocking command execution.

Did you find this page helpful?