|
|
@ -7,38 +7,41 @@ |
|
|
|
|
|
|
|
moduleselfname="$(basename "$(readlink -f "${BASH_SOURCE[0]}")")" |
|
|
|
|
|
|
|
jsoninfo=$( |
|
|
|
json=$( |
|
|
|
cat << EOF |
|
|
|
{ |
|
|
|
"chat_id": "${telegramchatid}", |
|
|
|
"message_thread_id": "${telegramthreadid}", |
|
|
|
"parse_mode": "HTML", |
|
|
|
"disable_notification": "${telegramdisablenotification}", |
|
|
|
"text": "<b>${alerttitle}</b>\n\n<b>Server name</b>\n${servername}\n\n<b>Information</b>\n${alertmessage}\n\n<b>Game</b>\n${gamename}\n\n<b>Server IP</b>\n${alertip}:${port}\n\n<b>Hostname</b>\n${HOSTNAME}\n\n<b>More info</b>\n<a href='${alerturl}'>${alerturl}</a>\n\n<b>Server Time</b>\n$(date)", |
|
|
|
"disable_web_page_preview": "yes" |
|
|
|
} |
|
|
|
"text": "<b>${alerttitle}</b>\n\n<b>Server name</b>\n${servername}\n\n<b>Information</b>\n${alertmessage}\n\n<b>Game</b>\n${gamename}\n\n<b>Server IP</b>\n${alertip}:${port}\n\n<b>Hostname</b>\n${HOSTNAME}\n\n |
|
|
|
EOF |
|
|
|
) |
|
|
|
|
|
|
|
jsonnoinfo=$( |
|
|
|
if [ -n "${querytype}" ]; then |
|
|
|
json+=$( |
|
|
|
cat << EOF |
|
|
|
{ |
|
|
|
"chat_id": "${telegramchatid}", |
|
|
|
"message_thread_id": "${telegramthreadid}", |
|
|
|
"parse_mode": "HTML", |
|
|
|
"disable_notification": "${telegramdisablenotification}", |
|
|
|
"text": "<b>${alerttitle}</b>\n\n<b>Server name</b>\n${servername}\n\n<b>Information</b>\n${alertmessage}\n\n<b>Game</b>\n${gamename}\n\n<b>Server IP</b>\n${alertip}:${port}\n\n<b>Hostname</b>\n${HOSTNAME}\n\n<b>Server Time</b>\n$(date)", |
|
|
|
<b>Is my Game Server Online?</b>\n<a href='https://ismygameserver.online/${querytype}/${alertip}:${queryport}'>Check here</a>\n\n |
|
|
|
EOF |
|
|
|
) |
|
|
|
fi |
|
|
|
|
|
|
|
if [ -n "${alerturl}" ]; then |
|
|
|
json+=$( |
|
|
|
cat << EOF |
|
|
|
<b>More info</b>\n<a href='${alerturl}'>${alerturl}</a>\n\n |
|
|
|
EOF |
|
|
|
) |
|
|
|
fi |
|
|
|
|
|
|
|
json+=$( |
|
|
|
cat << EOF |
|
|
|
<b>Server Time</b>\n$(date)", |
|
|
|
"disable_web_page_preview": "yes" |
|
|
|
} |
|
|
|
EOF |
|
|
|
) |
|
|
|
|
|
|
|
if [ -z "${alerturl}" ]; then |
|
|
|
json="${jsonnoinfo}" |
|
|
|
else |
|
|
|
json="${jsoninfo}" |
|
|
|
fi |
|
|
|
|
|
|
|
fn_print_dots "Sending Telegram alert" |
|
|
|
telegramsend=$(curl --connect-timeout 3 -sSL -H "Content-Type: application/json" -X POST -d "$(echo -n "${json}" | jq -c .)" ${curlcustomstring} "https://${telegramapi}/bot${telegramtoken}/sendMessage" | grep "error_code") |
|
|
|
|
|
|
|