#!/bin/bash # LinuxGSM alert_telegram.sh function # Author: Bennet Becker # Website: https://bytegaming.de # Description: Sends Telegram Messenger alert. local modulename="ALERT" local commandaction="Alert" local function_selfname=$(basename "$(readlink -f "${BASH_SOURCE[0]}")") json=$(cat <${alertsubject} ${alertemoji}\n\nMessage\n${alertbody}\n\nGame\n${gamename}\n\nServer name\n${servername}\n\nHostname\n${HOSTNAME}\n\nServer IP\n${alertip}:${port}\n\nMore info\n${alerturl}", "disable_web_page_preview": "yes", EOF ) fn_print_dots "Sending Telegram alert" telegramsend=$(curl -sSL -H "Content-Type: application/json" -X POST -d """${json}""" "https://api.telegram.org/bot${telegramtoken}/sendMessage" "${curlcustomstring}" | grep "error_code") if [ -n "${telegramsend}" ]; then fn_print_fail_nl "Sending Telegram alert: ${telegramsend}" fn_script_log_fatal "Sending Telegram alert: ${telegramsend}" else fn_print_ok_nl "Sending Telegram alert" fn_script_log_pass "Sent Telegram alert" fi