Browse Source

refactor: improve alert message formatting

- Refactored the code in `alert_pushover.sh` and `alert_telegram.sh` to improve the formatting of the alert messages.
- Updated the message structure to include the server name before other information.
- Added line breaks for better readability.
- Made sure that all variables are properly interpolated within the messages.
pull/4345/head
Daniel Gibbs 2 years ago
parent
commit
892a633d9d
No known key found for this signature in database GPG Key ID: 2076B128385E8C55
  1. 4
      lgsm/modules/alert_telegram.sh

4
lgsm/modules/alert_telegram.sh

@ -12,7 +12,7 @@ jsoninfo=$(
{
"chat_id": "${telegramchatid}",
"parse_mode": "HTML",
"text": "<b>${alerttitle}</b>\n\n<b>Information</b>\n${alertmessage}\n\n<b>Game</b>\n${gamename}\n\n<b>Server IP</b>\n${alertip}:${port}\n\n<b>Hostname</b>\n${HOSTNAME}\n\n<b>More info</b>\n<a href='${alerturl}'>${alerturl}</a>",
"text": "<b>${alerttitle}</b>\n\n<b>Server name</b>\n${servername}\n\n<b>Information</b>\n${alertmessage}\n\n<b>Game</b>\n${gamename}\n\n<b>Server IP</b>\n${alertip}:${port}\n\n<b>Hostname</b>\n${HOSTNAME}\n\n<b>More info</b>\n<a href='${alerturl}'>${alerturl}</a>",
"disable_web_page_preview": "yes"
}
EOF
@ -23,7 +23,7 @@ jsonnoinfo=$(
{
"chat_id": "${telegramchatid}",
"parse_mode": "HTML",
"text": "<b>${alerttitle}</b>\n\n<b>Information</b>\n${alertmessage}\n\n<b>Game</b>\n${gamename}\n\n<b>Server IP</b>\n${alertip}:${port}\n\n<b>Hostname</b>\n${HOSTNAME}",
"text": "<b>${alerttitle}</b>\n\n<b>Server name</b>\n${servername}\n\n<b>Information</b>\n${alertmessage}\n\n<b>Game</b>\n${gamename}\n\n<b>Server IP</b>\n${alertip}:${port}\n\n<b>Hostname</b>\n${HOSTNAME}",
"disable_web_page_preview": "yes"
}
EOF

Loading…
Cancel
Save