77
88moduleselfname=" $( basename " $( readlink -f " ${BASH_SOURCE[0]} " ) " ) "
99
10- jsoninfo =$(
10+ json =$(
1111 cat << EOF
1212{
1313 "username": "LinuxGSM",
@@ -29,103 +29,32 @@ jsoninfo=$(
2929 "url": "${alerticon} "
3030 },
3131 "fields": [
32- {
33- "name": "Server Name",
34- "value": "${servername} "
35- },
36- {
37- "name": "Information",
38- "value": "${alertmessage} "
39- },
4032 {
41- "name": "Game",
42- "value": "${gamename} ",
43- "inline": true
33+ "name": "Server Name",
34+ "value": "${servername} "
4435 },
4536 {
46- "name": "Server IP",
47- "value": "\` ${alertip} :${port} \` ",
48- "inline": true
49- },
50- {
51- "name": "Hostname",
52- "value": "${HOSTNAME} ",
53- "inline": true
37+ "name": "Information",
38+ "value": "${alertmessage} "
5439 },
55- {
56- "name": "More info",
57- "value": "${alerturl} ",
58- "inline": true
59- },
60- {
61- "name": "Server Time",
62- "value": "$( date) ",
63- "inline": true
64- }
65- ],
66- "footer": {
67- "icon_url": "https://raw.githubusercontent.com/${githubuser} /${githubrepo} /${githubbranch} /lgsm/data/alert_discord_logo.jpg",
68- "text": "Sent by LinuxGSM ${version} "
69- }
70- }
71- ]
72- }
73- EOF
74- )
75-
76- jsonnoinfo=$(
77- cat << EOF
78- {
79- "username": "LinuxGSM",
80- "avatar_url": "https://raw.githubusercontent.com/${githubuser} /${githubrepo} /${githubbranch} /lgsm/data/alert_discord_logo.jpg",
81- "file": "content",
82- "embeds": [
83- {
84- "author": {
85- "name": "LinuxGSM Alert",
86- "url": "",
87- "icon_url": "https://raw.githubusercontent.com/${githubuser} /${githubrepo} /${githubbranch} /lgsm/data/alert_discord_logo.jpg"
88- },
89- "title": "${alerttitle} ",
90- "url": "",
91- "description": "",
92- "color": "${alertcolourdec} ",
93- "type": "content",
94- "thumbnail": {
95- "url": "${alerticon} "
96- },
97- "fields": [
98- {
99- "name": "Server Name",
100- "value": "${servername} "
101- },
102- {
103- "name": "Information",
104- "value": "${alertmessage} "
105- },
10640 {
10741 "name": "Game",
10842 "value": "${gamename} ",
10943 "inline": true
11044 },
11145 {
112- "name": "Server IP",
113- "value": "\` ${alertip} :${port} \` ",
114- "inline": true
115- },
116- {
117- "name": "Hostname",
118- "value": "${HOSTNAME} ",
46+ "name": "Server Time",
47+ "value": "$( date) ",
11948 "inline": true
12049 },
12150 {
122- "name": "Server Time ",
123- "value": "$( date ) ",
51+ "name": "Is my Game Server Online? ",
52+ "value": "https://ismygameserver.online/ ${imgsoquerytype} / ${alertip} : ${queryport} ",
12453 "inline": true
12554 }
12655 ],
12756 "footer": {
128- "icon_url": "https://raw.githubusercontent.com/${githubuser} /${githubrepo} /${githubbranch} /lgsm/data/alert_discord_logo.jpg",
57+ "icon_url": "https://raw.githubusercontent.com/${githubuser} /${githubrepo} /${githubbranch} /lgsm/data/alert_discord_logo.jpg",
12958 "text": "Sent by LinuxGSM ${version} "
13059 }
13160 }
13665
13766fn_print_dots " Sending Discord alert"
13867
139- if [ -z " ${alerturl} " ]; then
140- json=" ${jsonnoinfo} "
141- else
142- json=" ${jsoninfo} "
143- fi
144-
14568discordsend=$( curl --connect-timeout 3 -sSL -H " Content-Type: application/json" -X POST -d " $( echo -n " ${json} " | jq -c .) " " ${discordwebhook} " )
14669
14770if [ -n " ${discordsend} " ]; then
0 commit comments