Browse Source

fix(alert): Restore more info in alert

pull/4767/head
Daniel Gibbs 4 months ago
parent
commit
b2eb64532b
  1. 113
      lgsm/modules/alert_discord.sh

113
lgsm/modules/alert_discord.sh

@ -10,68 +10,81 @@ moduleselfname="$(basename "$(readlink -f "${BASH_SOURCE[0]}")")"
json=$( json=$(
cat << EOF cat << EOF
{ {
"username": "LinuxGSM", "username": "LinuxGSM",
"avatar_url": "https://raw.githubusercontent.com/${githubuser}/${githubrepo}/${githubbranch}/lgsm/data/alert_discord_logo.jpg", "avatar_url": "https://raw.githubusercontent.com/${githubuser}/${githubrepo}/${githubbranch}/lgsm/data/alert_discord_logo.jpg",
"file": "content", "file": "content",
"embeds": [ "embeds": [
{ {
"author": { "author": {
"name": "LinuxGSM Alert", "name": "LinuxGSM Alert",
"url": "", "url": "",
"icon_url": "https://raw.githubusercontent.com/${githubuser}/${githubrepo}/${githubbranch}/lgsm/data/alert_discord_logo.jpg" "icon_url": "https://raw.githubusercontent.com/${githubuser}/${githubrepo}/${githubbranch}/lgsm/data/alert_discord_logo.jpg"
}, },
"title": "${alerttitle}", "title": "${alerttitle}",
"url": "", "url": "",
"description": "", "description": "",
"color": "${alertcolourdec}", "color": "${alertcolourdec}",
"type": "content", "type": "content",
"thumbnail": { "thumbnail": {
"url": "${alerticon}" "url": "${alerticon}"
}, },
"fields": [ "fields": [
{ {
"name": "Server Name", "name": "Server Name",
"value": "${servername}" "value": "${servername}"
}, },
{ {
"name": "Information", "name": "Information",
"value": "${alertmessage}" "value": "${alertmessage}"
}, },
{ {
"name": "Game", "name": "Game",
"value": "${gamename}", "value": "${gamename}",
"inline": true "inline": true
}, },
{ {
"name": "Server Time", "name": "Server Time",
"value": "$(date)", "value": "$(date)",
"inline": true "inline": true
} }
EOF EOF
) )
if [ -n "${querytype}" ]; then if [ -n "${querytype}" ]; then
json+=$( json+=$(
cat << EOF cat << EOF
, ,
{ {
"name": "Is my Game Server Online?", "name": "Is my Game Server Online?",
"value": "https://ismygameserver.online/${imgsoquerytype}/${alertip}:${queryport}", "value": "https://ismygameserver.online/${imgsoquerytype}/${alertip}:${queryport}",
"inline": true "inline": true
} }
EOF
)
fi
if [ -n "{alerturl}" ]; then
json+=$(
cat << EOF
,
{
"name": "More info",
"value": "${alerturl}",
"inline": true
}
EOF EOF
) )
fi fi
json+=$( json+=$(
cat << EOF cat << EOF
], ],
"footer": { "footer": {
"icon_url": "https://raw.githubusercontent.com/${githubuser}/${githubrepo}/${githubbranch}/lgsm/data/alert_discord_logo.jpg", "icon_url": "https://raw.githubusercontent.com/${githubuser}/${githubrepo}/${githubbranch}/lgsm/data/alert_discord_logo.jpg",
"text": "Sent by LinuxGSM ${version}" "text": "Sent by LinuxGSM ${version}"
} }
} }
] ]
} }
EOF EOF
) )

Loading…
Cancel
Save