How to perform an action after 24h? (not using setTimeout)

3756 views javascript
0

I have a Discord bot that has a punish command, and I want to make the bot remove the punishment after 24 hours/1 day. Don't want to use setTimeout() because the bot can go down between that period and setTimeout() consumes resources. How to do that? Thank you.

answered question

1 Answer

7

upon punishment, a variable can be assigned as Date.now()+86400000. When they log in and the current Date is greater than this value, the ban will end.

posted this

Have an answer?

JD

Please login first before posting an answer.