Selfcare fixes

This commit is contained in:
7cc5c4f330d47060 2024-10-30 14:11:49 -04:00
parent 3ae93be9ce
commit 2e036d5880
Signed by: 7cc5c4f330d47060
SSH key fingerprint: SHA256:e+4tcZut1nBpe10PqjaO+Rvie0Q7W4qIvFzcUw+7riA

View file

@ -16,6 +16,7 @@ module.exports = {
load: (b) => {
b.sc_tasks = {}
b.selfcareRun = 0
b._client.on('login', () => {
b.interval.sc = setInterval(() => {
if (Date.now() - b.selfcareRun <= 600) {
return
@ -23,10 +24,11 @@ module.exports = {
for (const i in b.sc_tasks) {
if (b.sc_tasks[i].failed) {
b.sc_tasks[i].failTask()
}
}
b.selfcareRun = Date.now()
}
}
}, 40)
})
b.add_sc_task = (name, failTask, startFailed) => {
b.sc_tasks[name] = new SCTask(failTask, startFailed)
}