@ -7,7 +7,7 @@
moduleselfname = " $( basename " $( readlink -f " ${ BASH_SOURCE [0] } " ) " ) "
json = $(
jsonnoinfo = $(
cat << EOF
{
"attachments" : [
@ -53,6 +53,10 @@ json=$(
{
"type" : "mrkdwn" ,
"text" : " *Hostname*\n ${ HOSTNAME } "
} ,
{
"type" : "mrkdwn" ,
"text" : " *Server Time*\n $( date) "
}
] ,
"accessory" : {
@ -71,7 +75,7 @@ json=$(
} ,
{
"type" : "plain_text" ,
"text" : " Sent by LinuxGSM ${ version } " ,
"text" : " Sent by LinuxGSM ${ version } - $( date) " ,
"emoji" : true
}
]
@ -83,6 +87,99 @@ json=$(
EOF
)
jsoninfo = $(
cat << EOF
{
"attachments" : [
{
"color" : " ${ alertcolourhex } " ,
"blocks" : [
{
"type" : "header" ,
"text" : {
"type" : "plain_text" ,
"text" : " ${ alerttitle } " ,
"emoji" : true
}
} ,
{
"type" : "divider"
} ,
{
"type" : "section" ,
"text" : {
"type" : "mrkdwn" ,
"text" : " *Server Name*\n ${ servername } "
}
} ,
{
"type" : "section" ,
"text" : {
"type" : "mrkdwn" ,
"text" : " *Information*\n ${ alertmessage } "
}
} ,
{
"type" : "section" ,
"fields" : [
{
"type" : "mrkdwn" ,
"text" : " *Game*\n ${ gamename } "
} ,
{
"type" : "mrkdwn" ,
"text" : " *Server IP*\n\` ${ alertip } : ${ port } \` "
} ,
{
"type" : "mrkdwn" ,
"text" : " *Hostname*\n ${ HOSTNAME } "
} ,
{
"type" : "mrkdwn" ,
"text" : " *Server Time*\n $( date) "
}
] ,
"accessory" : {
"type" : "image" ,
"image_url" : " ${ alerticon } " ,
"alt_text" : "cute cat"
}
} ,
{
"type" : "section" ,
"text" : {
"type" : "mrkdwn" ,
"text" : " *Server Time*\n ${ alertmessage } "
}
} ,
{
"type" : "context" ,
"elements" : [
{
"type" : "image" ,
"image_url" : " https://raw.githubusercontent.com/ ${ githubuser } / ${ githubrepo } / ${ githubbranch } /lgsm/data/alert_discord_logo.jpg " ,
"alt_text" : "LinuxGSM icon"
} ,
{
"type" : "plain_text" ,
"text" : " Sent by LinuxGSM ${ version } - $( date) " ,
"emoji" : true
}
]
}
]
}
]
}
EOF
)
if [ -z " ${ alerturl } " ] ; then
json = " ${ jsonnoinfo } "
else
json = " ${ jsoninfo } "
fi
fn_print_dots "Sending Slack alert"
slacksend = $( curl --connect-timeout 10 -sSL -H "Content-Type: application/json" -X POST -d " $( echo -n " ${ json } " | jq -c .) " " ${ slackwebhook } " )