7
7
8
8
moduleselfname=" $( basename " $( readlink -f " ${BASH_SOURCE[0]} " ) " ) "
9
9
10
- jsoninfo =$(
10
+ json =$(
11
11
cat << EOF
12
12
{
13
13
"username": "LinuxGSM",
@@ -29,103 +29,32 @@ jsoninfo=$(
29
29
"url": "${alerticon} "
30
30
},
31
31
"fields": [
32
- {
33
- "name": "Server Name",
34
- "value": "${servername} "
35
- },
36
- {
37
- "name": "Information",
38
- "value": "${alertmessage} "
39
- },
40
32
{
41
- "name": "Game",
42
- "value": "${gamename} ",
43
- "inline": true
33
+ "name": "Server Name",
34
+ "value": "${servername} "
44
35
},
45
36
{
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} "
54
39
},
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
- },
106
40
{
107
41
"name": "Game",
108
42
"value": "${gamename} ",
109
43
"inline": true
110
44
},
111
45
{
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) ",
119
48
"inline": true
120
49
},
121
50
{
122
- "name": "Server Time ",
123
- "value": "$( date ) ",
51
+ "name": "Is my Game Server Online? ",
52
+ "value": "https://ismygameserver.online/ ${imgsoquerytype} / ${alertip} : ${queryport} ",
124
53
"inline": true
125
54
}
126
55
],
127
56
"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",
129
58
"text": "Sent by LinuxGSM ${version} "
130
59
}
131
60
}
136
65
137
66
fn_print_dots " Sending Discord alert"
138
67
139
- if [ -z " ${alerturl} " ]; then
140
- json=" ${jsonnoinfo} "
141
- else
142
- json=" ${jsoninfo} "
143
- fi
144
-
145
68
discordsend=$( curl --connect-timeout 3 -sSL -H " Content-Type: application/json" -X POST -d " $( echo -n " ${json} " | jq -c .) " " ${discordwebhook} " )
146
69
147
70
if [ -n " ${discordsend} " ]; then
0 commit comments