replace organizedCrime with unavailableOC, and make it reset the timer to 24hrs ago when all conditions are fulfilled so its ready to go next time conditions are not met
This commit is contained in:
@@ -53,6 +53,12 @@ module.exports = async (client, torn, config, state) => {
|
||||
state.ocAlertLast = now.toISOString();
|
||||
fs.writeFile('./state.json', JSON.stringify(state, null, 4), err => {if (err) {console.error(err)}});
|
||||
}
|
||||
} else {
|
||||
const now = new Date();
|
||||
const twentyFourHoursAgo = new Date(now.getTime() - 24 * 60 * 60 * 1000);
|
||||
state.ocAlertLast = twentyFourHoursAgo.toISOString();
|
||||
fs.writeFile('./state.json', JSON.stringify(state, null, 4), err => {if (err) {console.error(err)}});
|
||||
|
||||
}
|
||||
});
|
||||
};
|
||||
Reference in New Issue
Block a user