From b2eb64532b4458c9f59fd880f9872ad79b7ecfab Mon Sep 17 00:00:00 2001 From: Daniel Gibbs Date: Fri, 7 Mar 2025 16:27:57 +0000 Subject: [PATCH] fix(alert): Restore more info in alert --- lgsm/modules/alert_discord.sh | 113 +++++++++++++++++++--------------- 1 file changed, 63 insertions(+), 50 deletions(-) diff --git a/lgsm/modules/alert_discord.sh b/lgsm/modules/alert_discord.sh index 2b50f0c01..1ed3da441 100644 --- a/lgsm/modules/alert_discord.sh +++ b/lgsm/modules/alert_discord.sh @@ -10,68 +10,81 @@ moduleselfname="$(basename "$(readlink -f "${BASH_SOURCE[0]}")")" json=$( cat << EOF { - "username": "LinuxGSM", - "avatar_url": "https://raw.githubusercontent.com/${githubuser}/${githubrepo}/${githubbranch}/lgsm/data/alert_discord_logo.jpg", - "file": "content", - "embeds": [ - { - "author": { - "name": "LinuxGSM Alert", - "url": "", - "icon_url": "https://raw.githubusercontent.com/${githubuser}/${githubrepo}/${githubbranch}/lgsm/data/alert_discord_logo.jpg" - }, - "title": "${alerttitle}", - "url": "", - "description": "", - "color": "${alertcolourdec}", - "type": "content", - "thumbnail": { - "url": "${alerticon}" - }, - "fields": [ - { - "name": "Server Name", - "value": "${servername}" - }, - { - "name": "Information", - "value": "${alertmessage}" - }, - { - "name": "Game", - "value": "${gamename}", - "inline": true - }, - { - "name": "Server Time", - "value": "$(date)", - "inline": true - } + "username": "LinuxGSM", + "avatar_url": "https://raw.githubusercontent.com/${githubuser}/${githubrepo}/${githubbranch}/lgsm/data/alert_discord_logo.jpg", + "file": "content", + "embeds": [ + { + "author": { + "name": "LinuxGSM Alert", + "url": "", + "icon_url": "https://raw.githubusercontent.com/${githubuser}/${githubrepo}/${githubbranch}/lgsm/data/alert_discord_logo.jpg" + }, + "title": "${alerttitle}", + "url": "", + "description": "", + "color": "${alertcolourdec}", + "type": "content", + "thumbnail": { + "url": "${alerticon}" + }, + "fields": [ + { + "name": "Server Name", + "value": "${servername}" + }, + { + "name": "Information", + "value": "${alertmessage}" + }, + { + "name": "Game", + "value": "${gamename}", + "inline": true + }, + { + "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 - } + , + { + "name": "Is my Game Server Online?", + "value": "https://ismygameserver.online/${imgsoquerytype}/${alertip}:${queryport}", + "inline": true + } +EOF + ) +fi + +if [ -n "{alerturl}" ]; then + json+=$( + cat << EOF + , + { + "name": "More info", + "value": "${alerturl}", + "inline": true + } EOF ) fi json+=$( cat << EOF - ], - "footer": { - "icon_url": "https://raw.githubusercontent.com/${githubuser}/${githubrepo}/${githubbranch}/lgsm/data/alert_discord_logo.jpg", - "text": "Sent by LinuxGSM ${version}" - } - } - ] + ], + "footer": { + "icon_url": "https://raw.githubusercontent.com/${githubuser}/${githubrepo}/${githubbranch}/lgsm/data/alert_discord_logo.jpg", + "text": "Sent by LinuxGSM ${version}" + } + } + ] } EOF )