Răsfoiți Sursa

update slack

Daniel Gibbs 4 ani în urmă
părinte
comite
1f1a4f67ae

+ 1 - 1
lgsm/functions/alert_discord.sh

@@ -15,7 +15,7 @@ json=$(cat <<EOF
 	"embeds": [
 		{
 			"author": {
-				"name": "LinuxGSM",
+				"name": "LinuxGSM Alert",
 				"url": "",
 				"icon_url": "https://raw.githubusercontent.com/${githubuser}/${githubrepo}/${githubbranch}/lgsm/data/alert_discord_logo.jpg"
 			},

+ 1 - 1
lgsm/functions/alert_ifttt.sh

@@ -11,7 +11,7 @@ json=$(cat <<EOF
 {
 	"value1": "${selfname}",
 	"value2": "${alertemoji} ${alertsubject} ${alertemoji}",
-	"value3": "Server name\n${servername}\n\nInformation\n${alertdescription}\n\nGame\n${gamename}\n\n${alertplayerstitle}\n${alertplayers}\n\nMap\n${alertmap}\n\nServer IP\n${alertip}:${port}\n\nHostname\n${HOSTNAME}\n\nMore info\n${alerturl}"
+	"value3": "Server name<br>${servername}<br><br>Information<br>${alertdescription}<br><br>Game<br>${gamename}<br><br>${alertplayerstitle}<br>${alertplayers}<br><br>Map<br>${alertmap}<br><br>Server IP<br>${alertip}:${port}<br><br>Hostname<br>${HOSTNAME}<br><br>More info<br>${alerturl}"
 }
 EOF
 )

+ 109 - 47
lgsm/functions/alert_slack.sh

@@ -9,54 +9,116 @@ functionselfname="$(basename "$(readlink -f "${BASH_SOURCE[0]}")")"
 
 json=$(cat <<EOF
 {
-		"attachments": [
-			{
-				"color": "#36a64f",
-				"blocks": [
-					{
-										"type": "section",
-										"text": {
-												"type": "mrkdwn",
-												"text": "*LinuxGSM Alert*"
-										}
-								},
-								{
-										"type": "section",
-										"text": {
-												"type": "mrkdwn",
-												"text": "*${alertemoji} ${alertsubject}* \n ${alertdescription}"
-										}
-								},
-								{
-										"type": "divider"
-								},
-								{
-										"type": "section",
-										"fields": [
-												{
-														"type": "mrkdwn",
-														"text": "*Game:* \n ${gamename}"
-												},
-												{
-														"type": "mrkdwn",
-														"text": "*Server IP:* \n ${alertip}:${port}"
-												},
-												{
-														"type": "mrkdwn",
-														"text": "*Server Name:* \n ${servername}"
-												}
-										]
-								},
-					 {
-										"type": "section",
-										"text": {
-														"type": "mrkdwn",
-														"text": "Hostname: ${HOSTNAME} / More info: ${alerturl}"
-										}
-								}
-						]
+	"blocks": [
+		{
+			"type": "context",
+			"elements": [
+				{
+					"type": "image",
+					"image_url": "https://raw.githubusercontent.com/GameServerManagers/LinuxGSM/master/lgsm/data/alert_discord_logo.jpg",
+					"alt_text": "LinuxGSM"
+				},
+				{
+					"type": "mrkdwn",
+					"text": "*LinuxGSM Alert*"
+				}
+			]
+		},
+		{
+			"type": "header",
+			"text": {
+				"type": "plain_text",
+				"text": "${servername}",
+				"emoji": true
 			}
-		]
+		},
+		{
+			"type": "section",
+			"text": {
+				"type": "mrkdwn",
+				"text": "*${alertemoji} ${alertsubject}* \n ${alertdescription}"
+			}
+		},
+		{
+			"type": "section",
+			"text": {
+				"type": "mrkdwn",
+				"text": "*Game:* ${gamename}"
+			}
+		},
+		{
+			"type": "section",
+			"fields": [
+				{
+					"type": "mrkdwn",
+					"text": "*Maxplayers*"
+				},
+				{
+					"type": "mrkdwn",
+					"text": "*Map*"
+				},
+				{
+					"type": "mrkdwn",
+					"text": "${alertplayers}"
+				},
+				{
+					"type": "mrkdwn",
+					"text": "${alertmap}"
+				}
+			]
+		},
+		{
+			"type": "section",
+			"fields": [
+				{
+					"type": "mrkdwn",
+					"text": "*Server IP*"
+				},
+				{
+					"type": "mrkdwn",
+					"text": "*Hostname*"
+				},
+				{
+					"type": "mrkdwn",
+					"text": "[${alertip}:${port}"
+				},
+				{
+					"type": "mrkdwn",
+					"text": "${HOSTNAME}"
+				}
+			]
+		},
+		{
+			"type": "section",
+			"text": {
+				"type": "mrkdwn",
+				"text": "*Information*\n${alertdescription} \n More info: ${alerturl}"
+			}
+		},
+		{
+			"type": "image",
+			"image_url": "${alertimage}",
+			"alt_text": "${gamename}"
+		},
+		{
+			"type": "divider"
+		},
+		{
+			"type": "context",
+			"elements": [
+				{
+					"type": "image",
+					"image_url": "https://raw.githubusercontent.com/GameServerManagers/LinuxGSM/master/lgsm/data/alert_discord_logo.jpg",
+					"alt_text": "LinuxGSM Logo"
+				},
+				{
+					"type": "plain_text",
+					"text": "Powered by LinuxGSM",
+					"emoji": true
+				}
+			]
+		}
+	]
 }
 EOF
 )