Browse Source

add server date

feature/alerts-refactor
Daniel Gibbs 4 years ago
parent
commit
14196ed68d
No known key found for this signature in database GPG Key ID: 2EBB36015C6D78E2
  1. 23
      lgsm/functions/alert.sh
  2. 11
      lgsm/functions/alert_discord.sh
  3. 17
      lgsm/functions/alert_rocketchat.sh

23
lgsm/functions/alert.sh

@ -64,27 +64,38 @@ fn_alert_restart_query(){
}
fn_alert_update(){
fn_script_log_info "Sending alert: Updated: ${selfname}"
alerttitle="Alert - ${selfname} - Updated"
fn_script_log_info "Sending alert: Game server updated: ${selfname}"
alerttitle="Alert - ${selfname} - Game server updated"
alertemoji="🎉"
alertsound="1"
alerttriggermessage="${selfname} has received an update."
alerttriggermessage="${selfname} has received an game server update."
# Green
alertcolourhex="#00cd00"
alertcolourdec="52480"
}
fn_alert_check_update(){
fn_script_log_info "Sending alert: Update available"
alerttitle="Alert - ${selfname} - Update available"
fn_script_log_info "Sending alert: Game server update available"
alerttitle="Alert - ${selfname} - Game server Update available"
alertemoji="💿"
alertsound="1"
alerttriggermessage="Update available for ${selfname}."
alerttriggermessage="Game server update available for ${selfname}."
# Blue
alertcolourhex="#1e90ff"
alertcolourdec="2003199"
}
fn_alert_update_linuxgsm(){
fn_script_log_info "Sending alert: LinuxGSM updated: ${selfname}"
alerttitle="Alert - ${selfname} - LinuxGSM updated"
alertemoji="🎉"
alertsound="1"
alerttriggermessage="${selfname} has received a LinuxGSM update."
# Green
alertcolourhex="#00cd00"
alertcolourdec="52480"
}
fn_alert_permissions(){
fn_script_log_info "Sending alert: Permissions error"
alerttitle="Alert - ${selfname}: Permissions error"

11
lgsm/functions/alert_discord.sh

@ -25,9 +25,8 @@ json=$(cat <<EOF
"color": "${alertcolourdec}",
"fields": [
{
"name": "Game",
"value": "${gamename}",
"inline": true
"name": "Game",
"value": "${gamename}"
},
{
"name": "${alertplayerstitle}",
@ -54,6 +53,10 @@ json=$(cat <<EOF
"value": "${alertversion}",
"inline": true
},
"name": "Server time",
"value": "$(date)",
"inline": true
},
{
"name": "Trigger Message",
"value": "${alerttriggermessage}"
@ -70,7 +73,7 @@ json=$(cat <<EOF
"url": "${alertimage}"
},
"footer": {
"text": "Powered by LinuxGSM ${version}",
"text": "Powered by LinuxGSM ${version} - $(date)",
"icon_url": "https://raw.githubusercontent.com/${githubuser}/${githubrepo}/${githubbranch}/lgsm/data/alert_discord_logo.jpg"
}
}

17
lgsm/functions/alert_rocketchat.sh

@ -10,24 +10,24 @@ functionselfname="$(basename "$(readlink -f "${BASH_SOURCE[0]}")")"
json=$(cat <<EOF
{
"alias": "LinuxGSM",
"text": "*${servername}*\n${alertemoji} ${alerttitle} ${alertemoji}\n\n*Trigger Message*\n${alerttriggermessage}\n\n*More info*\n${alertmoreinfourl}",
"text": "*${servername}*\n${alertemoji} ${alerttitle} ${alertemoji}\n\n*Trigger Message*\n${alerttriggermessage}\n\n*More info*\n${alertmoreinfourl}\n\n*Game*\n${gamename}",
"attachments": [
{
"fields": [
{
"short": true,
"title": "Game",
"value": "${gamename}"
"title": "Map",
"value": "${alertmap}"
},
{
"short": true,
"title": "${alertplayerstitle}",
"value": "${gamename}"
"value": "${alertmap}"
},
{
"short": true,
"title": "Map",
"value": "${alertmap}"
"title": "Server Time",
"value": "$(date)"
},
{
"short": true,
@ -44,6 +44,11 @@ json=$(cat <<EOF
"title": "Version",
"value": "${alertversion}"
}
{
"short": true,
"title": "Version",
"value": "${alertversion}"
}
]
}
]

Loading…
Cancel
Save