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
1 changed files with 10 additions and 0 deletions

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"
# do things when you see output
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
PING*)
echo "${result/I/O}" >> "$input"