Browse Source

add gameversion

feature/alerts-refactor
Daniel Gibbs 4 years ago
parent
commit
121c012353
  1. 6
      lgsm/functions/alert.sh
  2. 9
      lgsm/functions/alert_discord.sh
  3. 2
      lgsm/functions/query_gamedig.sh

6
lgsm/functions/alert.sh

@ -170,6 +170,12 @@ else
alertmap="Unknown" alertmap="Unknown"
fi fi
if [ -n "${gdversion}" ]; then
alertversion="${gdmap}"
else
alertversion="Unknown"
fi
if [ "${alert}" == "permissions" ]; then if [ "${alert}" == "permissions" ]; then
fn_alert_permissions fn_alert_permissions

9
lgsm/functions/alert_discord.sh

@ -21,7 +21,7 @@ json=$(cat <<EOF
}, },
"title": "${servername}", "title": "${servername}",
"url": "", "url": "",
"description": "${alertemoji} ${alertsubject}", "description": "${alertemoji} ${alertsubject} ${alertemoji}",
"color": "${alertcolourdec}", "color": "${alertcolourdec}",
"fields": [ "fields": [
{ {
@ -49,6 +49,11 @@ json=$(cat <<EOF
"value": "${HOSTNAME}", "value": "${HOSTNAME}",
"inline": true "inline": true
}, },
{
"name": "Version",
"value": "${alertversion}",
"inline": true
},
{ {
"name": "Information", "name": "Information",
"value": "${alertdescription} \n More info: ${alerturl}" "value": "${alertdescription} \n More info: ${alerturl}"
@ -72,7 +77,7 @@ EOF
fn_print_dots "Sending Discord alert" fn_print_dots "Sending Discord alert"
discordsend=$(curl --connect-timeout 10 -sSL -H "Content-Type: application/json" -X POST -d "$(echo -n "${json}" | jq -c .)" "${discordwebhook}") discordsend=$(curl --connect-timeout 10 -sSL -H "Content-Type: application/json" -X POST -d "$(echo -en "${json}" | jq -c .)" "${discordwebhook}")
if [ -n "${discordsend}" ]; then if [ -n "${discordsend}" ]; then
fn_print_fail_nl "Sending Discord alert: ${discordsend}" fn_print_fail_nl "Sending Discord alert: ${discordsend}"

2
lgsm/functions/query_gamedig.sh

@ -81,7 +81,7 @@ if [ "$(command -v gamedig 2>/dev/null)" ]&&[ "$(command -v jq 2>/dev/null)" ];
# server version. # server version.
if [ "${querytype}" == "teamspeak3" ]; then if [ "${querytype}" == "teamspeak3" ]; then
dversion=$(echo "${gamedigraw}" | jq -re '.raw.virtualserver_version') gdversion=$(echo "${gamedigraw}" | jq -re '.raw.virtualserver_version')
else else
gdversion=$(echo "${gamedigraw}" | jq -re '.raw.version') gdversion=$(echo "${gamedigraw}" | jq -re '.raw.version')
fi fi

Loading…
Cancel
Save