ignore list updates when nick changes.

This commit is contained in:
Storm Dragon 2020-08-20 17:58:54 -04:00
parent 57c135c3c5
commit 90751d595a

10
bot.sh
View File

@ -44,6 +44,16 @@ tail -f "$input" | telnet "$server" "$port" | while read -r result ; do
echo "$(date "+[$dateFormat]") $result" >> "$log" echo "$(date "+[$dateFormat]") $result" >> "$log"
# do things when you see output # do things when you see output
case "$result" in case "$result" in
# Handle nick changes
":"*"NICK :"*)
# Get the original nick
originalNick="${result#:}"
originalNick="${originalNick%%!*}"
# If the old nick was in the ignore list, update it.
if [[ "${originalNick}" =~ [${ignoreList}] ]]; then
export ignoreList="${ignoreList/${originalNick}/${result#:*:}}"
fi
;;
# respond to ping requests from the server # respond to ping requests from the server
PING*) PING*)
echo "${result/I/O}" >> "$input" echo "${result/I/O}" >> "$input"