diff --git a/lgsm/modules/alert_discord.sh b/lgsm/modules/alert_discord.sh index 574f6248ba..8bfea9fa2f 100644 --- a/lgsm/modules/alert_discord.sh +++ b/lgsm/modules/alert_discord.sh @@ -29,6 +29,14 @@ jsoninfo=$( "url": "${alerticon}" }, "fields": [ + { + "name": "Server Name", + "value": "${servername}" + }, + { + "name": "Information", + "value": "${alertmessage}" + }, { "name": "Game", "value": "${gamename}", @@ -43,15 +51,7 @@ jsoninfo=$( "name": "Hostname", "value": "${HOSTNAME}", "inline": true - }, - { - "name": "Information", - "value": "${alertmessage}" - }, - { - "name": "More Information", - "value": "${alerturl}" - } + } ], "footer": { "icon_url": "https://raw.githubusercontent.com/${githubuser}/${githubrepo}/${githubbranch}/lgsm/data/alert_discord_logo.jpg", @@ -85,6 +85,14 @@ jsonnoinfo=$( "url": "${alerticon}" }, "fields": [ + { + "name": "Server Name", + "value": "${servername}" + }, + { + "name": "Information", + "value": "${alertmessage}" + }, { "name": "Game", "value": "${gamename}", @@ -99,11 +107,7 @@ jsonnoinfo=$( "name": "Hostname", "value": "${HOSTNAME}", "inline": true - }, - { - "name": "Information", - "value": "${alertmessage}" - } + } ], "footer": { "icon_url": "https://raw.githubusercontent.com/${githubuser}/${githubrepo}/${githubbranch}/lgsm/data/alert_discord_logo.jpg", diff --git a/lgsm/modules/alert_gotify.sh b/lgsm/modules/alert_gotify.sh index 7cda984894..232c108933 100644 --- a/lgsm/modules/alert_gotify.sh +++ b/lgsm/modules/alert_gotify.sh @@ -7,18 +7,33 @@ module_selfname="$(basename "$(readlink -f "${BASH_SOURCE[0]}")")" -json=$( +jsoninfo=$( cat << EOF { "title": "${alerttitle}", - "message": "Server name\n${servername}\n\nInformation\n${alertmessage}\n\nGame\n${gamename}\n\nServer IP\n${alertip}:${port}\n\nHostname\n${HOSTNAME}\n\nMore info\n${alerturl}", + "message": "Server Name\n${servername}\n\nInformation\n${alertmessage}\n\nGame\n${gamename}\n\nServer IP\n${alertip}:${port}\n\nHostname\n${HOSTNAME}\n\nMore info\n${alerturl}", "priority": 5 } EOF ) -fn_print_dots "Sending Gotify alert" +jsonnoinfo=$( + cat << EOF +{ + "title": "${alerttitle}", + "message": "Server Name\n${servername}\n\nInformation\n${alertmessage}\n\nGame\n${gamename}\n\nServer IP\n${alertip}:${port}\n\nHostname\n${HOSTNAME}", + "priority": 5 +} +EOF +) + +if [ -z "${alerturl}" ]; then + json="${jsonnoinfo}" +else + json="${jsoninfo}" +fi +fn_print_dots "Sending Gotify alert" gotifysend=$(curl --connect-timeout 10 -sSL "${gotifywebhook}/message"?token="${gotifytoken}" -H "Content-Type: application/json" -X POST -d "$(echo -n "${json}" | jq -c .)") if [ -n "${gotifysend}" ]; then diff --git a/lgsm/modules/alert_ifttt.sh b/lgsm/modules/alert_ifttt.sh index 12a9a9fec7..d6affa6222 100644 --- a/lgsm/modules/alert_ifttt.sh +++ b/lgsm/modules/alert_ifttt.sh @@ -12,7 +12,7 @@ jsoninfo=$( { "value1": "${selfname}", "value2": "${alerttitle}", - "value3": "Information \n${alertmessage}\n\nGame: \n${gamename}\n\nServer name \n${servername}\n\nHostname \n${HOSTNAME}\n\nServer IP \n${alertip}:${port}\n\nMore info \n${alerturl}" + "value3": "Server Name\n${servername}\n\nInformation\n${alertmessage}\n\nGame\n${gamename}\n\nServer IP\n${alertip}:${port}\n\nHostname\n${HOSTNAME}\n\nMore info\n${alerturl}" } EOF ) @@ -22,7 +22,7 @@ jsonnoinfo=$( { "value1": "${selfname}", "value2": "${alerttitle}", - "value3": "Information \n${alertmessage}\n\nGame: \n${gamename}\n\nServer name \n${servername}\n\nHostname \n${HOSTNAME}\n\nServer IP \n${alertip}:${port}" + "value3": "Server Name\n${servername}\n\nInformation\n${alertmessage}\n\nGame\n${gamename}\n\nServer IP\n${alertip}:${port}\n\nHostname\n${HOSTNAME}" } EOF ) diff --git a/lgsm/modules/alert_pushbullet.sh b/lgsm/modules/alert_pushbullet.sh index a8f8e56b5d..47419e663e 100644 --- a/lgsm/modules/alert_pushbullet.sh +++ b/lgsm/modules/alert_pushbullet.sh @@ -13,7 +13,7 @@ jsoninfo=$( "channel_tag": "${channeltag}", "type": "note", "title": "${alerttitle}", - "body": "Information\n${alertmessage}\n\nGame\n${gamename}\n\nServer IP\n${alertip}:${port}\n\nHostname\n${HOSTNAME}\n\nMore info\n${alerturl}" + "body": "Server Name\n${servername}\n\nInformation\n${alertmessage}\n\nGame\n${gamename}\n\nServer IP\n${alertip}:${port}\n\nHostname\n${HOSTNAME}\n\nMore info\n${alerturl}" } EOF ) @@ -24,7 +24,7 @@ jsonnoinfo=$( "channel_tag": "${channeltag}", "type": "note", "title": "${alerttitle}", - "body": "Information\n${alertmessage}\n\nGame\n${gamename}\n\nServer IP\n${alertip}:${port}\n\nHostname\n${HOSTNAME}" + "body": "Server Name\n${servername}\n\nInformation\n${alertmessage}\n\nGame\n${gamename}\n\nServer IP\n${alertip}:${port}\n\nHostname\n${HOSTNAME}" } EOF ) diff --git a/lgsm/modules/alert_rocketchat.sh b/lgsm/modules/alert_rocketchat.sh index fa9b6fdfe2..136039e05a 100644 --- a/lgsm/modules/alert_rocketchat.sh +++ b/lgsm/modules/alert_rocketchat.sh @@ -7,11 +7,11 @@ moduleselfname="$(basename "$(readlink -f "${BASH_SOURCE[0]}")")" -json=$( +jsoninfo=$( cat << EOF { "alias": "LinuxGSM", - "text": "*${alerttitle}* \n ${alertmessage} \n More info: ${alerturl}", + "text": "*${alerttitle}*\n${alertmessage}\nMore info: ${alerturl}", "attachments": [ { "fields": [ @@ -37,8 +37,43 @@ json=$( EOF ) -fn_print_dots "Sending Rocketchat alert" +jsonnoinfo=$( + cat << EOF +{ + "alias": "LinuxGSM", + "text": "*${alerttitle}*\n${alertmessage}", + "attachments": [ + { + "fields": [ + { + "short": true, + "title": "Game", + "value": "${gamename}" + }, + { + "short": true, + "title": "Server IP", + "value": "${alertip}:${port}" + }, + { + "short": true, + "title": "Hostname", + "value": "${HOSTNAME}" + } + ] + } + ] +} +EOF +) +if [ -z "${alerturl}" ]; then + json="${jsonnoinfo}" +else + json="${jsoninfo}" +fi + +fn_print_dots "Sending Rocketchat alert" rocketchatsend=$(curl --connect-timeout 10 -sSL -H "Content-Type: application/json" -X POST -d "$(echo -n "${json}" | jq -c .)" "${rocketchatwebhook}") if [ -n "${rocketchatsend}" ]; then diff --git a/lgsm/modules/alert_slack.sh b/lgsm/modules/alert_slack.sh index d192e4cd4d..8f8ccb61f7 100644 --- a/lgsm/modules/alert_slack.sh +++ b/lgsm/modules/alert_slack.sh @@ -25,6 +25,20 @@ json=$( { "type": "divider" }, + { + "type": "section", + "text": { + "type": "mrkdwn", + "text": "*Server Name*\n${servername}" + } + }, + { + "type": "section", + "text": { + "type": "mrkdwn", + "text": "*Information*\n${alertmessage}" + } + }, { "type": "section", "fields": [ @@ -47,13 +61,6 @@ json=$( "alt_text": "cute cat" } }, - { - "type": "section", - "text": { - "type": "mrkdwn", - "text": "*Information*\n${alertmessage}" - } - }, { "type": "context", "elements": [ diff --git a/lgsm/modules/alert_telegram.sh b/lgsm/modules/alert_telegram.sh index 085c1d8f4a..fb89263a6e 100644 --- a/lgsm/modules/alert_telegram.sh +++ b/lgsm/modules/alert_telegram.sh @@ -12,7 +12,7 @@ jsoninfo=$( { "chat_id": "${telegramchatid}", "parse_mode": "HTML", - "text": "${alerttitle}\n\nServer name\n${servername}\n\nInformation\n${alertmessage}\n\nGame\n${gamename}\n\nServer IP\n${alertip}:${port}\n\nHostname\n${HOSTNAME}\n\nMore info\n${alerturl}", + "text": "${alerttitle}\n\nInformation\n${alertmessage}\n\nGame\n${gamename}\n\nServer IP\n${alertip}:${port}\n\nHostname\n${HOSTNAME}\n\nMore info\n${alerturl}", "disable_web_page_preview": "yes" } EOF @@ -23,7 +23,7 @@ jsonnoinfo=$( { "chat_id": "${telegramchatid}", "parse_mode": "HTML", - "text": "${alerttitle}\n\nServer name\n${servername}\n\nInformation\n${alertmessage}\n\nGame\n${gamename}\n\nServer IP\n${alertip}:${port}\n\nHostname\n${HOSTNAME}\n\nMore info\n${alerturl}", + "text": "${alerttitle}\n\nInformation\n${alertmessage}\n\nGame\n${gamename}\n\nServer IP\n${alertip}:${port}\n\nHostname\n${HOSTNAME}", "disable_web_page_preview": "yes" } EOF