Command that runs every millisecond - Discord.js V13

How would I make a command that runs every millisecond to check my database for a timestamp that matches the Date.now() for my premium system?
11 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.
treble/luna
treble/luna2y ago
that seems like a terrible idea because you might get ratelimited on your db
Encrypted_Noobi
Encrypted_NoobiOP2y ago
So how would I fix this?
treble/luna
treble/luna2y ago
just do it every minute or so or every 10 minutes
Encrypted_Noobi
Encrypted_NoobiOP2y ago
I could do that, but how would I do it every certain amount of time?
treble/luna
treble/luna2y ago
setTimeout or alternatively cron but i have no experience with that or setInterval iirc
Encrypted_Noobi
Encrypted_NoobiOP2y ago
How would I use the setTimeout to do it every 10 minutes, instead of it doing it only once? That has been removed from v13.
d.js docs
d.js docs2y ago
mdn setInterval() global function The setInterval() method, offered on the Window and Worker interfaces, repeatedly calls a function or executes a code snippet, with a fixed time delay between each call.
Encrypted_Noobi
Encrypted_NoobiOP2y ago
Oh that one mb
treble/luna
treble/luna2y ago
that has nothing to do with djs
Encrypted_Noobi
Encrypted_NoobiOP2y ago
I was talking about client.setInterval
Want results from more Discord servers?
Add your server