mirror of
https://github.com/koreanbots/core.git
synced 2025-12-15 14:10:22 +00:00
fix: webhook failed since not working as intended (#550)
* fix: webhook failed since not working as intended * fix: match to milliseconds
This commit is contained in:
parent
4648c3e84b
commit
72843bfeb1
@ -134,17 +134,17 @@ export const sendWebhook = async (target: Bot | Server, payload: WebhookPayload)
|
|||||||
}
|
}
|
||||||
}
|
}
|
||||||
|
|
||||||
if(Date.now() - webhook.failedSince > 1000 * 60 * 60 * 24) {
|
if(!webhook.failedSince) {
|
||||||
|
await update.webhook(id, isBot ? 'bots' : 'servers', {
|
||||||
|
failedSince: Math.floor(Date.now() / 1000)
|
||||||
|
})
|
||||||
|
} else if(Date.now() - webhook.failedSince * 1000 > 1000 * 60 * 60 * 24) {
|
||||||
await update.webhook(id, isBot ? 'bots' : 'servers', {
|
await update.webhook(id, isBot ? 'bots' : 'servers', {
|
||||||
status: WebhookStatus.Disabled,
|
status: WebhookStatus.Disabled,
|
||||||
failedSince: null,
|
failedSince: null,
|
||||||
secret: null
|
secret: null
|
||||||
})
|
})
|
||||||
sendFailedMessage(target)
|
sendFailedMessage(target)
|
||||||
} else if(!webhook.failedSince) {
|
|
||||||
await update.webhook(id, isBot ? 'bots' : 'servers', {
|
|
||||||
failedSince: Date.now()
|
|
||||||
})
|
|
||||||
}
|
}
|
||||||
return false
|
return false
|
||||||
}
|
}
|
||||||
|
|||||||
Loading…
x
Reference in New Issue
Block a user