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:
@ -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) &&
|
||||
|
Reference in New Issue
Block a user