diff --git a/lgsm/modules/alert_discord.sh b/lgsm/modules/alert_discord.sh index 3b489984d1..22c62db290 100644 --- a/lgsm/modules/alert_discord.sh +++ b/lgsm/modules/alert_discord.sh @@ -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,8 @@ 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}")