1
0
mirror of https://github.com/tormachris/cf-workers-status-page.git synced 2025-07-17 04:15:15 +02:00

chore: readme collectResponseTimes example

This commit is contained in:
Adam Janis
2020-11-22 15:40:28 +01:00
parent c5eb49cf01
commit 3ed15409b5
5 changed files with 20 additions and 8 deletions

View File

@ -13,7 +13,7 @@ export async function setKVMonitors(data) {
return setKV(kvDataKey, JSON.stringify(data))
}
const getOperationalLabel = operational => {
const getOperationalLabel = (operational) => {
return operational
? config.settings.monitorLabelOperational
: config.settings.monitorLabelNotOperational
@ -33,7 +33,9 @@ export async function notifySlack(monitor, operational) {
type: 'section',
text: {
type: 'mrkdwn',
text: `Monitor *${monitor.name}* changed status to *${getOperationalLabel(operational)}*`,
text: `Monitor *${
monitor.name
}* changed status to *${getOperationalLabel(operational)}*`,
},
},
{
@ -61,8 +63,13 @@ export async function notifySlack(monitor, operational) {
}
export async function notifyTelegram(monitor, operational) {
const text = `Monitor *${monitor.name.replace('-', '\\-')}* changed status to *${getOperationalLabel(operational)}*
${operational ? '✅' : '❌'} \`${monitor.method ? monitor.method : "GET"} ${monitor.url}\` \\- 👀 [Status Page](${config.settings.url})`
const text = `Monitor *${monitor.name.replace(
'-',
'\\-',
)}* changed status to *${getOperationalLabel(operational)}*
${operational ? '✅' : '❌'} \`${monitor.method ? monitor.method : 'GET'} ${
monitor.url
}\` \\- 👀 [Status Page](${config.settings.url})`
const payload = new FormData()
payload.append('chat_id', SECRET_TELEGRAM_CHAT_ID)