1
0
mirror of https://github.com/tormachris/cf-workers-status-page.git synced 2025-09-21 16:35:15 +02:00

feat: telegram notifications

This commit is contained in:
kolaente
2020-11-22 15:29:22 +01:00
parent 81bcf9770e
commit a41f9d28c1
4 changed files with 50 additions and 5 deletions

View File

@ -2,6 +2,7 @@ import config from '../../config.yaml'
import {
notifySlack,
notifyTelegram,
getCheckLocation,
getKVMonitors,
setKVMonitors,
@ -76,6 +77,15 @@ export async function processCronTrigger(event) {
event.waitUntil(notifySlack(monitor, monitorOperational))
}
// Send Telegram message on monitor change
if (
monitorStatusChanged
&& typeof SECRET_TELEGRAM_API_TOKEN !== 'undefined' && SECRET_TELEGRAM_API_TOKEN !== 'default-gh-action-secret'
&& typeof SECRET_TELEGRAM_CHAT_ID !== 'undefined' && SECRET_TELEGRAM_CHAT_ID !== 'default-gh-action-secret'
) {
event.waitUntil(notifyTelegram(monitor, monitorOperational))
}
// make sure checkDay exists in checks in cases when needed
if (
(config.settings.collectResponseTimes || !monitorOperational) &&