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:
2025-11-08 19:24:33 -05:00
parent cdeef2189a
commit ed918a74ae

View File

@@ -53,6 +53,12 @@ module.exports = async (client, torn, config, state) => {
state.ocAlertLast = now.toISOString(); state.ocAlertLast = now.toISOString();
fs.writeFile('./state.json', JSON.stringify(state, null, 4), err => {if (err) {console.error(err)}}); 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)}});
} }
}); });
}; };