diff --git a/lgsm/functions/alert.sh b/lgsm/functions/alert.sh index df321c250..3d51cbe1e 100644 --- a/lgsm/functions/alert.sh +++ b/lgsm/functions/alert.sh @@ -10,30 +10,40 @@ local commandaction="Alert" fn_alert_test(){ fn_script_log_info "Sending test alert" alertsubject="LinuxGSM Alert - Test - ${servername}" + alertemoji="🚨" + alerturl="https://gameservermanagers.com" alertbody="Testing LinuxGSM Alert. No action to be taken." } fn_alert_restart(){ fn_script_log_info "Sending restart alert: ${executable} process not running" alertsubject="LinuxGSM Alert - Restarted - ${servername}" + alertemoji="🚨" + alerturl="https://gameservermanagers.com" alertbody="${servicename} ${executable} process not running" } fn_alert_restart_query(){ fn_script_log_info "Sending restart alert: ${gsquerycmd}" alertsubject="LinuxGSM Alert- Restarted - ${servername}" + alertemoji="🚨" + alerturl="https://gameservermanagers.com" alertbody="gsquery.py failed to query: ${gsquerycmd}" } fn_alert_update(){ fn_script_log_info "Sending update alert" alertsubject="LinuxGSM Alert- Updated - ${servername}" + alertemoji="🎮" + alerturl="https://gameservermanagers.com" alertbody="${servicename} received update" } fn_alert_permissions(){ fn_script_log_info "Sending permissions error alert" alertsubject="LinuxGSM Alert - Error - ${servername}" + alertemoji="❗" + alerturl="https://gameservermanagers.com" alertbody="${servicename} has permissions issues." } @@ -82,7 +92,7 @@ elif [ -z "${telegramtoken}" ]&&[ "${function_selfname}" == "command_test_alert. elif [ -z "${telegramchatid}" ]&&[ "${function_selfname}" == "command_test_alert.sh" ]; then fn_print_error_nl "Telegram chat id not set." echo " * https://github.com/GameServerManagers/LinuxGSM/wiki/Telegram" - fn_script_error_warn "Telegram chat id not set. Get one from @botfather" + fn_script_error_warn "Telegram chat id not set." fi if [ "${discordalert}" == "on" ]&&[ -n "${discordalert}" ]; then @@ -92,5 +102,6 @@ elif [ "${discordalert}" != "on" ]&&[ "${function_selfname}" == "command_test_al fn_script_log_warn "Discord alerts not enabled" elif [ -z "${discordalert}" ]&&[ "${function_selfname}" == "command_test_alert.sh" ]; then fn_print_error_nl "Discord token not set" + echo " * https://github.com/GameServerManagers/LinuxGSM/wiki/Discord" fn_script_error_warn "Discord token not set" fi diff --git a/lgsm/functions/alert_telegram.sh b/lgsm/functions/alert_telegram.sh index 4f07ed174..e0e0bde54 100644 --- a/lgsm/functions/alert_telegram.sh +++ b/lgsm/functions/alert_telegram.sh @@ -12,7 +12,7 @@ local function_selfname="$(basename $(readlink -f "${BASH_SOURCE[0]}"))" json=$(cat <${alertsubject}\n\n${alertbody}", + "text": "${alertemoji} ${alertsubject} ${alertemoji}\n\n${alertbody}", "parse_mode": "HTML", } EOF @@ -23,9 +23,9 @@ sleep 1 telegramsend=$(curl -sSL -H "Content-Type: application/json" -X POST -d """$json""" "https://api.telegram.org/bot${telegramtoken}/sendMessage" | grep -Po '(?<="description":").*?(?=")'|uniq) if [ -n "${telegramsend}" ]; then - fn_print_fail_nl "Sending Telegram Message: ${telegramsend}" - fn_script_log_fatal "Sending Telegram Message: ${telegramsend}" + fn_print_fail_nl "Sending Telegram Alert: ${telegramsend}" + fn_script_log_fatal "Sending Telegram Alert: ${telegramsend}" else - fn_print_ok_nl "Sending Telegram Message" - fn_script_log_pass "Sent Telegram Message" + fn_print_ok_nl "Sending Telegram Alert" + fn_script_log_pass "Sent Telegram Alert" fi