Compare commits
2 Commits
c1b8d3de36
...
b61d6c673c
| Author | SHA1 | Date | |
|---|---|---|---|
|
|
b61d6c673c | ||
|
|
259195b021 |
10
bot.sh
10
bot.sh
@@ -76,6 +76,7 @@ export input
|
|||||||
export ignoreList
|
export ignoreList
|
||||||
export nick
|
export nick
|
||||||
export quitMessage
|
export quitMessage
|
||||||
|
export intentionalExit
|
||||||
|
|
||||||
# Check for critical dependencies needed by the bot core
|
# Check for critical dependencies needed by the bot core
|
||||||
coreDependencies=("socat" "tail" "shuf" "grep" "sed" "tr" "cut" "date")
|
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 exiting ffrom the program to remove the temporary input file.
|
||||||
trap rm_input EXIT
|
trap rm_input EXIT
|
||||||
|
|
||||||
|
# Flag to track intentional shutdown (set by exit module)
|
||||||
|
intentionalExit=false
|
||||||
|
|
||||||
# Reconnection loop - keeps bot connected even if connection drops
|
# Reconnection loop - keeps bot connected even if connection drops
|
||||||
reconnectDelay=10
|
reconnectDelay=10
|
||||||
while true; do
|
while true; do
|
||||||
@@ -334,6 +338,12 @@ while true; do
|
|||||||
done
|
done
|
||||||
|
|
||||||
# If we reach here, the connection was dropped
|
# 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"
|
echo "Connection lost. Reconnecting in $reconnectDelay seconds... [$(date "+$dateFormat")]" | tee -a "$log"
|
||||||
sleep "$reconnectDelay"
|
sleep "$reconnectDelay"
|
||||||
done
|
done
|
||||||
|
|||||||
@@ -24,6 +24,7 @@ check_dependencies() {
|
|||||||
}
|
}
|
||||||
|
|
||||||
close_bot() {
|
close_bot() {
|
||||||
|
intentionalExit=true
|
||||||
echo -en "QUIT :${quitMessage}\r\n" >> "$input"
|
echo -en "QUIT :${quitMessage}\r\n" >> "$input"
|
||||||
}
|
}
|
||||||
|
|
||||||
|
|||||||
@@ -3,6 +3,7 @@
|
|||||||
|
|
||||||
advice=(
|
advice=(
|
||||||
'If love hurts, move slightly to the left.'
|
'If love hurts, move slightly to the left.'
|
||||||
|
"Keep smiling. It confuses the autopsy report."
|
||||||
'When in doubt, mumble.'
|
'When in doubt, mumble.'
|
||||||
"Some people are like clouds, when they disappear it's a beautiful day."
|
"Some people are like clouds, when they disappear it's a beautiful day."
|
||||||
"Proof that light travels faster than sound? Some people appear bright until they speak."
|
"Proof that light travels faster than sound? Some people appear bright until they speak."
|
||||||
|
|||||||
Reference in New Issue
Block a user