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_alert_update(){
fn_script_log_info "Sending alert: Updated: ${selfname}" fn_script_log_info "Sending alert: Game server updated: ${selfname}"
alerttitle="Alert - ${selfname} - Updated" alerttitle="Alert - ${selfname} - Game server updated"
alertemoji="🎉" alertemoji="🎉"
alertsound="1" alertsound="1"
alerttriggermessage="${selfname} has received an update." alerttriggermessage="${selfname} has received an game server update."
# Green # Green
alertcolourhex="#00cd00" alertcolourhex="#00cd00"
alertcolourdec="52480" alertcolourdec="52480"
} }
fn_alert_check_update(){ fn_alert_check_update(){
fn_script_log_info "Sending alert: Update available" fn_script_log_info "Sending alert: Game server update available"
alerttitle="Alert - ${selfname} - Update available" alerttitle="Alert - ${selfname} - Game server Update available"
alertemoji="💿" alertemoji="💿"
alertsound="1" alertsound="1"
alerttriggermessage="Update available for ${selfname}." alerttriggermessage="Game server update available for ${selfname}."
# Blue # Blue
alertcolourhex="#1e90ff" alertcolourhex="#1e90ff"
alertcolourdec="2003199" 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_alert_permissions(){
fn_script_log_info "Sending alert: Permissions error" fn_script_log_info "Sending alert: Permissions error"
alerttitle="Alert - ${selfname}: Permissions error" alerttitle="Alert - ${selfname}: Permissions error"

11
lgsm/functions/alert_discord.sh

@ -25,9 +25,8 @@ json=$(cat <<EOF
"color": "${alertcolourdec}", "color": "${alertcolourdec}",
"fields": [ "fields": [
{ {
"name": "Game", "name": "Game",
"value": "${gamename}", "value": "${gamename}"
"inline": true
}, },
{ {
"name": "${alertplayerstitle}", "name": "${alertplayerstitle}",
@ -54,6 +53,10 @@ json=$(cat <<EOF
"value": "${alertversion}", "value": "${alertversion}",
"inline": true "inline": true
}, },
"name": "Server time",
"value": "$(date)",
"inline": true
},
{ {
"name": "Trigger Message", "name": "Trigger Message",
"value": "${alerttriggermessage}" "value": "${alerttriggermessage}"
@ -70,7 +73,7 @@ json=$(cat <<EOF
"url": "${alertimage}" "url": "${alertimage}"
}, },
"footer": { "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" "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 json=$(cat <<EOF
{ {
"alias": "LinuxGSM", "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": [ "attachments": [
{ {
"fields": [ "fields": [
{ {
"short": true, "short": true,
"title": "Game", "title": "Map",
"value": "${gamename}" "value": "${alertmap}"
}, },
{ {
"short": true, "short": true,
"title": "${alertplayerstitle}", "title": "${alertplayerstitle}",
"value": "${gamename}" "value": "${alertmap}"
}, },
{ {
"short": true, "short": true,
"title": "Map", "title": "Server Time",
"value": "${alertmap}" "value": "$(date)"
}, },
{ {
"short": true, "short": true,
@ -44,6 +44,11 @@ json=$(cat <<EOF
"title": "Version", "title": "Version",
"value": "${alertversion}" "value": "${alertversion}"
} }
{
"short": true,
"title": "Version",
"value": "${alertversion}"
}
] ]
} }
] ]

Loading…
Cancel
Save