Added ignoreList for things that should be ignore for bot triggers.

This commit is contained in:
Storm Dragon 2020-08-14 21:17:43 -04:00
parent 751657369d
commit 255edc3075
2 changed files with 23 additions and 4 deletions

View File

@ -25,3 +25,4 @@ curseKicker=true
botCaller=",.!+?"
# People who are allowed to private message the bot separate multiple names with |
allowList=""
ignoreList="storm_bot"

26
bot.sh
View File

@ -9,7 +9,7 @@ fi
input=".botinput"
close_bot() {
echo -en "QUIT :$quitMessage\r\n" >> "$input"
echo -en "QUIT :${quitMessage}\r\n" | telnet "$server" "$port"
rm "$input"
exit 0
}
@ -78,6 +78,22 @@ tail -f "$input" | telnet "$server" "$port" | while read -r result ; do
set +f
fi
;;
# run when a private message is seen
*"PRIVMSG "[[:alnum:]-_]*)
echo "$result" >> "$log"
who="${result%%!*}"
who="${who:1}"
from="${who%!*}"
command="${result#:* PRIVMSG [[:alnum:]_-]*:}"
command="${command//# /}"
will="${command#* }"
command="${command%% *}"
if [[ "$from" =~ $allowList ]]; then
./modules/say/say.sh "$who" "#$channel" $from really loves me, they sent me a private message saying $command $will
else
reply "$who" "You are not in the allowed list for this bot. If you think this is an error, please contact the bot's administrator."
fi
;;
# run when a message is seen
*PRIVMSG*)
echo "$result" >> "$log"
@ -110,9 +126,11 @@ tail -f "$input" | telnet "$server" "$port" | while read -r result ; do
./modules/say/say.sh "$who" "$from" "$who: $(shuf -n1 "response/error.txt")"
fi
else
set -f
./triggers/keywords/keywords.sh "$who" "$from" "$result"
set +f
if ! [[ "$who" =~ $ignoreList ]]; then
set -f
./triggers/keywords/keywords.sh "$who" "$from" "$result"
set +f
fi
fi
;;
*)