Added ignoreList for things that should be ignore for bot triggers.
This commit is contained in:
parent
751657369d
commit
255edc3075
1
bot.cfg
1
bot.cfg
@ -25,3 +25,4 @@ curseKicker=true
|
||||
botCaller=",.!+?"
|
||||
# People who are allowed to private message the bot separate multiple names with |
|
||||
allowList=""
|
||||
ignoreList="storm_bot"
|
||||
|
20
bot.sh
20
bot.sh
@ -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,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")"
|
||||
fi
|
||||
else
|
||||
if ! [[ "$who" =~ $ignoreList ]]; then
|
||||
set -f
|
||||
./triggers/keywords/keywords.sh "$who" "$from" "$result"
|
||||
set +f
|
||||
fi
|
||||
fi
|
||||
;;
|
||||
*)
|
||||
echo "$result" >> "$log"
|
||||
|
Loading…
Reference in New Issue
Block a user