Fixed a bug where you could call the bot by putting :${botCaller}command in the middle or end of the text and it would work. Commands only fire now if the caller is used at the beginning of the line.

This commit is contained in:
Storm Dragon 2020-08-19 20:23:59 -04:00
parent 166948749c
commit 1041c973a4

2
bot.sh
View File

@ -137,7 +137,7 @@ tail -f "$input" | telnet "$server" "$port" | while read -r result ; do
./triggers/link/link.sh "$who" "$from" "$result" ./triggers/link/link.sh "$who" "$from" "$result"
set -f set -f
# Although this calls modules, it triggers on text other than the bot's nick # Although this calls modules, it triggers on text other than the bot's nick
elif [[ "$result" =~ ^.*PRIVMSG.*:[${botCaller}].* ]]; then elif [[ "${result#:*:}" =~ ^[${botCaller}][a-zA-Z_].* ]]; then
command="${result#*:[[:punct:]]}" command="${result#*:[[:punct:]]}"
command="${command//# /}" command="${command//# /}"
will="${command#* }" will="${command#* }"