diff --git a/lgsm/modules/alert_discord.sh b/lgsm/modules/alert_discord.sh index a16e10811..5eccc06c9 100644 --- a/lgsm/modules/alert_discord.sh +++ b/lgsm/modules/alert_discord.sh @@ -7,7 +7,7 @@ moduleselfname="$(basename "$(readlink -f "${BASH_SOURCE[0]}")")" -jsonshortinfo=$( +jsoninfo=$( cat << EOF { "username": "LinuxGSM", @@ -63,7 +63,7 @@ jsonshortinfo=$( EOF ) -jsonshortnoinfo=$( +jsonnoinfo=$( cat << EOF { "username": "LinuxGSM", @@ -117,10 +117,10 @@ EOF fn_print_dots "Sending Discord alert" -if [ "${alerturl}" == "not enabled" ]; then - json="${jsonshortnoinfo}" +if [ -z "${alerturl}" ]; then + json="${jsonnoinfo}" else - json="${jsonshortinfo}" + json="${jsoninfo}" fi discordsend=$(curl --connect-timeout 10 -sSL -H "Content-Type: application/json" -X POST -d "$(echo -n "${json}" | jq -c .)" "${discordwebhook}") diff --git a/lgsm/modules/alert_pushbullet.sh b/lgsm/modules/alert_pushbullet.sh index d1db7bfd1..0a0145386 100644 --- a/lgsm/modules/alert_pushbullet.sh +++ b/lgsm/modules/alert_pushbullet.sh @@ -7,17 +7,34 @@ moduleselfname="$(basename "$(readlink -f "${BASH_SOURCE[0]}")")" -json=$( +jsoninfo=$( cat << EOF { "channel_tag": "${channeltag}", "type": "note", "title": "${alertemoji} ${alerttitle} ${alertemoji}", - "body": "Server name\n${servername}\n\nMessage\n${alertmessage}\n\nGame\n${gamename}\n\nServer IP\n${alertip}:${port}\n\nHostname\n${HOSTNAME}\n\nMore info\n${alerturl}" + "body": "Server name\n${servername}\n\nInformation\n${alertmessage}\n\nGame\n${gamename}\n\nServer IP\n${alertip}:${port}\n\nHostname\n${HOSTNAME}\n\nMore info\n${alerturl}" } EOF ) +jsonnoinfo=$( + cat << EOF +{ + "channel_tag": "${channeltag}", + "type": "note", + "title": "${alertemoji} ${alerttitle} ${alertemoji}", + "body": "Server name\n${servername}\n\nInformation\n${alertmessage}\n\nGame\n${gamename}\n\nServer IP\n${alertip}:${port}\n\nHostname\n${HOSTNAME}" +} +EOF +) + +if [ -z "${alerturl}" ]; then + json="${jsonnoinfo}" +else + json="${jsoninfo}" +fi + fn_print_dots "Sending Pushbullet alert" pushbulletsend=$(curl --connect-timeout 10 -sSL -H "Access-Token: ${pushbullettoken}" -H "Content-Type: application/json" -X POST -d "$(echo -n "${json}" | jq -c .)" "https://api.pushbullet.com/v2/pushes" | grep "error_code")