From 89ec3abc485167b981a52f2b379b74cb9db256fb Mon Sep 17 00:00:00 2001 From: Daniel Gibbs Date: Sun, 1 Oct 2023 23:28:59 +0100 Subject: [PATCH] feat: add conditional printing of alert messages This commit adds conditional statements to only print alert messages if the corresponding alerts are turned on. This improves the readability of the output by only displaying relevant information. - Added conditionals for Discord, Email, Gotify, IFTTT, Pushbullet, Pushover, Rocketchat, Slack, and Telegram alerts - Only prints alert messages if the corresponding alerts are turned on --- lgsm/modules/info_messages.sh | 38 +++++++++++++++++++++++++---------- 1 file changed, 27 insertions(+), 11 deletions(-) diff --git a/lgsm/modules/info_messages.sh b/lgsm/modules/info_messages.sh index 2cf6a774e..530f26e20 100644 --- a/lgsm/modules/info_messages.sh +++ b/lgsm/modules/info_messages.sh @@ -543,25 +543,41 @@ fn_info_message_script() { fi # Discord alert - echo -e "${lightblue}Discord alert:\t${default}${discordalert}" + if [ "${discordalert}" == "on" ]; then + echo -e "${lightblue}Discord alert:\t${default}${discordalert}" + fi # Email alert - echo -e "${lightblue}Email alert:\t${default}${emailalert}" + if [ "${emailalert}" == "on" ]; then + echo -e "${lightblue}Email alert:\t${default}${emailalert}" + fi # Gotify alert - echo -e "${lightblue}Gotify alert:\t${default}${gotifyalert}" + if [ "${gotifyalert}" == "on" ]; then + echo -e "${lightblue}Gotify alert:\t${default}${gotifyalert}" + fi # IFTTT alert - echo -e "${lightblue}IFTTT alert:\t${default}${iftttalert}" - # Mailgun alert - echo -e "${lightblue}Mailgun (email) alert:\t${default}${mailgunalert}" + if [ "${iftttalert}" == "on" ]; then + echo -e "${lightblue}IFTTT alert:\t${default}${iftttalert}" + fi # Pushbullet alert - echo -e "${lightblue}Pushbullet alert:\t${default}${pushbulletalert}" + if [ "${pushbulletalert}" == "on" ]; then + echo -e "${lightblue}Pushbullet alert:\t${default}${pushbulletalert}" + fi # Pushover alert - echo -e "${lightblue}Pushover alert:\t${default}${pushoveralert}" + if [ "${pushoveralert}" == "on" ]; then + echo -e "${lightblue}Pushover alert:\t${default}${pushoveralert}" + fi # Rocketchat alert - echo -e "${lightblue}Rocketchat alert:\t${default}${rocketchatalert}" + if [ "${rocketchatalert}" == "on" ]; then + echo -e "${lightblue}Rocketchat alert:\t${default}${rocketchatalert}" + fi # Slack alert - echo -e "${lightblue}Slack alert:\t${default}${slackalert}" + if [ "${slackalert}" == "on" ]; then + echo -e "${lightblue}Slack alert:\t${default}${slackalert}" + fi # Telegram alert - echo -e "${lightblue}Telegram alert:\t${default}${telegramalert}" + if [ "${telegramalert}" == "on" ]; then + echo -e "${lightblue}Telegram alert:\t${default}${telegramalert}" + fi # Update on start if [ -n "${updateonstart}" ]; then