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 toolkit12mo 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/luna12mo ago
that seems like a terrible idea because you might get ratelimited on your db
Encrypted_Noobi
Encrypted_Noobi12mo ago
So how would I fix this?
treble/luna
treble/luna12mo ago
just do it every minute or so or every 10 minutes
Encrypted_Noobi
Encrypted_Noobi12mo ago
I could do that, but how would I do it every certain amount of time?
treble/luna
treble/luna12mo ago
setTimeout or alternatively cron but i have no experience with that or setInterval iirc
Encrypted_Noobi
Encrypted_Noobi12mo 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 docs12mo 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_Noobi12mo ago
Oh that one mb
treble/luna
treble/luna12mo ago
that has nothing to do with djs
Encrypted_Noobi
Encrypted_Noobi12mo ago
I was talking about client.setInterval