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=",.!+?" botCaller=",.!+?"
# People who are allowed to private message the bot separate multiple names with | # People who are allowed to private message the bot separate multiple names with |
allowList="" allowList=""
ignoreList="storm_bot"

20
bot.sh
View File

@ -9,7 +9,7 @@ fi
input=".botinput" input=".botinput"
close_bot() { close_bot() {
echo -en "QUIT :$quitMessage\r\n" >> "$input" echo -en "QUIT :${quitMessage}\r\n" | telnet "$server" "$port"
rm "$input" rm "$input"
exit 0 exit 0
} }
@ -78,6 +78,22 @@ tail -f "$input" | telnet "$server" "$port" | while read -r result ; do
set +f set +f
fi 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 # run when a message is seen
*PRIVMSG*) *PRIVMSG*)
echo "$result" >> "$log" echo "$result" >> "$log"
@ -110,10 +126,12 @@ tail -f "$input" | telnet "$server" "$port" | while read -r result ; do
./modules/say/say.sh "$who" "$from" "$who: $(shuf -n1 "response/error.txt")" ./modules/say/say.sh "$who" "$from" "$who: $(shuf -n1 "response/error.txt")"
fi fi
else else
if ! [[ "$who" =~ $ignoreList ]]; then
set -f set -f
./triggers/keywords/keywords.sh "$who" "$from" "$result" ./triggers/keywords/keywords.sh "$who" "$from" "$result"
set +f set +f
fi fi
fi
;; ;;
*) *)
echo "$result" >> "$log" echo "$result" >> "$log"