From b61d6c673c43a23d8b419d7e6ab4814efdba4622 Mon Sep 17 00:00:00 2001 From: Storm Dragon Date: Sat, 25 Oct 2025 17:02:55 -0400 Subject: [PATCH] Fixed the exit command to actually exit instead of trying to reconnect. --- bot.sh | 10 ++++++++++ functions.sh | 1 + 2 files changed, 11 insertions(+) diff --git a/bot.sh b/bot.sh index 3b625d9..7f5278a 100755 --- a/bot.sh +++ b/bot.sh @@ -76,6 +76,7 @@ export input export ignoreList export nick export quitMessage +export intentionalExit # Check for critical dependencies needed by the bot core coreDependencies=("socat" "tail" "shuf" "grep" "sed" "tr" "cut" "date") @@ -129,6 +130,9 @@ trim_log() { # Trap exiting ffrom the program to remove the temporary input file. trap rm_input EXIT +# Flag to track intentional shutdown (set by exit module) +intentionalExit=false + # Reconnection loop - keeps bot connected even if connection drops reconnectDelay=10 while true; do @@ -334,6 +338,12 @@ while true; do done # If we reach here, the connection was dropped + # Check if this was an intentional exit + if [[ "$intentionalExit" == "true" ]]; then + echo "Bot shutdown requested. Exiting. [$(date "+$dateFormat")]" | tee -a "$log" + break + fi + echo "Connection lost. Reconnecting in $reconnectDelay seconds... [$(date "+$dateFormat")]" | tee -a "$log" sleep "$reconnectDelay" done diff --git a/functions.sh b/functions.sh index 967d9d7..43120ba 100644 --- a/functions.sh +++ b/functions.sh @@ -24,6 +24,7 @@ check_dependencies() { } close_bot() { + intentionalExit=true echo -en "QUIT :${quitMessage}\r\n" >> "$input" }