From f215c1e143843d21a6c50b5b3cf9a3d27b2f5f03 Mon Sep 17 00:00:00 2001 From: Daniel Gibbs Date: Wed, 8 Jan 2025 19:09:26 +0000 Subject: [PATCH] fix: add missing imgso filter if not required in discord alert --- lgsm/modules/alert_discord.sh | 20 ++++++++++++++++++-- 1 file changed, 18 insertions(+), 2 deletions(-) diff --git a/lgsm/modules/alert_discord.sh b/lgsm/modules/alert_discord.sh index 3b489984d1..c58bcdc0bd 100644 --- a/lgsm/modules/alert_discord.sh +++ b/lgsm/modules/alert_discord.sh @@ -8,7 +8,7 @@ moduleselfname="$(basename "$(readlink -f "${BASH_SOURCE[0]}")")" json=$( - cat << EOF + cat << EOF { "username": "LinuxGSM", "avatar_url": "https://raw.githubusercontent.com/${githubuser}/${githubrepo}/${githubbranch}/lgsm/data/alert_discord_logo.jpg", @@ -46,12 +46,25 @@ json=$( "name": "Server Time", "value": "$(date)", "inline": true - }, + } +EOF +) + +if [ -n "${querytype}" ]; then + json+=$( + cat << EOF + , { "name": "Is my Game Server Online?", "value": "https://ismygameserver.online/${imgsoquerytype}/${alertip}:${queryport}", "inline": true } +EOF + ) +fi + +json+=$( + cat << EOF ], "footer": { "icon_url": "https://raw.githubusercontent.com/${githubuser}/${githubrepo}/${githubbranch}/lgsm/data/alert_discord_logo.jpg", @@ -63,6 +76,9 @@ json=$( EOF ) +echo "${json}" +) + fn_print_dots "Sending Discord alert" discordsend=$(curl --connect-timeout 3 -sSL -H "Content-Type: application/json" -X POST -d "$(echo -n "${json}" | jq -c .)" "${discordwebhook}")