From 2546170efd4de431e92dd165f9de038101da22d6 Mon Sep 17 00:00:00 2001 From: Daniel Gibbs Date: Mon, 21 Aug 2017 18:25:10 +0100 Subject: [PATCH] Alert updates --- lgsm/functions/alert_discord.sh | 18 ++++++++++++---- lgsm/functions/alert_pushbullet.sh | 34 +++++++++++++++--------------- 2 files changed, 31 insertions(+), 21 deletions(-) diff --git a/lgsm/functions/alert_discord.sh b/lgsm/functions/alert_discord.sh index 234817069..ae3d1bc1c 100644 --- a/lgsm/functions/alert_discord.sh +++ b/lgsm/functions/alert_discord.sh @@ -5,6 +5,10 @@ # Website: https://gameservermanagers.com # Description: Sends Discord alert including the server status. +local commandname="ALERT" +local commandaction="Alert" +local function_selfname="$(basename $(readlink -f "${BASH_SOURCE[0]}"))" + json=$(cat <f -curl -v -X POST --data @f ${discordwebhook} +if [ -n "${discordsend}" ]; then + fn_print_fail_nl "Sending Discord alert: ${discordsend}" + fn_script_log_fatal "Sending Discord alert: ${discordsend}" +else + fn_print_ok_nl "Sending Discord alert" + fn_script_log_pass "Sending Discord alert" +fi diff --git a/lgsm/functions/alert_pushbullet.sh b/lgsm/functions/alert_pushbullet.sh index 27e8d2ba3..b228796f6 100644 --- a/lgsm/functions/alert_pushbullet.sh +++ b/lgsm/functions/alert_pushbullet.sh @@ -11,20 +11,20 @@ local function_selfname="$(basename $(readlink -f "${BASH_SOURCE[0]}"))" # converts text to ascii then passes to curl. allowing special characters to be sent e.g % # http://stackoverflow.com/a/10660730 fn_rawurlencode() { - local string="${1}" - local strlen=${#string} - local encoded="" - local pos c o + local string="${1}" + local strlen=${#string} + local encoded="" + local pos c o - for (( pos=0 ; pos