Business
Jobs
  • About Us
  • Solutions
    • Job Postings
      Post your job and receive qualified candidates in 48h.
    • Candidate Assessments
      500+ technical and psychological tests, plus anti-fraud.
    • Headhunting
      Tailor-made executive search from start to finish.
    • Payroll + EOR
      Payroll dispersal and EOR across 15+ LATAM countries.
  • Pricing
  • Jobs

0

222
Views
Make setTimeout() work after closing and opening an application

So atm I'm working on a Discord.js bot and have a command to ban people. The issue is if I turn the bot off and on again all the setTimeouts reset. So say, if I were to ban someone for a week, turn the bot off and on in between there, they will never automatically be unbanned.

setTimeout(function () {
                    memberTarget.roles.remove(bannedRole);
                }, ms(args[1]));

What other way could I use for it to remember to unban everyone after the bot has been turned on again?

about 4 years ago · Juan Pablo Isaza
1 answers
Answer question

0

You need to use database or data persist

Store bans data to database/data persist then set worker to check for unban (expiry).

Database https://www.tutorialsteacher.com/nodejs/data-access-in-nodejs

Data Persist https://www.npmjs.com/package/node-persist

about 4 years ago · Juan Pablo Isaza Report
Answer question
Find remote jobs

Discover the new way to find a job!

Top jobs
Top job categories
Business
Post vacancy Pricing Sales
Legal
Terms and conditions Privacy policy
© 2026 PeakU Inc. All Rights Reserved.
Andres GPT
Show me some job opportunities
There's an error!