Rewrite timer command to use JSON
* Rewrite parseTime to use seconds instead of ms * Move parseTime to timer subdirectory * Implement checkTimer and sendTimerReminder.
This commit is contained in:
parent
a4b75b0161
commit
04f39582a4
7 changed files with 55 additions and 14 deletions
11
util/timer/checkTimer.js
Normal file
11
util/timer/checkTimer.js
Normal file
|
@ -0,0 +1,11 @@
|
|||
const checkTimer = require('./checkTimer')
|
||||
const sendTimerReminder = require('./sendTimerReminder')
|
||||
module.exports = function (client) {
|
||||
client.timers.forEach(timer => {
|
||||
if(parseInt(timer.reminderDate) >= Math.floor(new Date() / 1000)){
|
||||
sendTimerReminder(client, timer);
|
||||
client.timers.pop(timer);
|
||||
}
|
||||
});
|
||||
setTimeout(checkTimer, 1000, client);
|
||||
}
|
Loading…
Add table
Add a link
Reference in a new issue