Fixed wildcard expansion bug.

This commit is contained in:
Storm Dragon 2017-04-02 10:41:28 -04:00
parent 41c1e2ad43
commit 01b75635c3

14
bot.sh
View File

@ -47,7 +47,9 @@ do
fi fi
echo "MODE #$channel +o $who" | tee -a "$input" echo "MODE #$channel +o $who" | tee -a "$input"
if [ "${greet^^}" = "TRUE" ]; then if [ "${greet^^}" = "TRUE" ]; then
set -f
./triggers/greet/greet.sh "$who" "$from" ./triggers/greet/greet.sh "$who" "$from"
set +f
fi fi
;; ;;
# run when someone leaves # run when someone leaves
@ -60,7 +62,9 @@ do
continue continue
fi fi
if [ "${leave^^}" = "TRUE" ]; then if [ "${leave^^}" = "TRUE" ]; then
set -f
./triggers/bye/bye.sh "$who" "$from" ./triggers/bye/bye.sh "$who" "$from"
set +f
fi fi
;; ;;
# run when a message is seen # run when a message is seen
@ -83,9 +87,15 @@ do
if [ -z "$(ls modules/ | grep -i -- "$command")" ] || [ -z "$command" ]; then if [ -z "$(ls modules/ | grep -i -- "$command")" ] || [ -z "$command" ]; then
continue continue
fi fi
# Disable wildcards
set -f
./modules/${command% *}/${command% *}.sh "$who" "$from" $will ./modules/${command% *}/${command% *}.sh "$who" "$from" $will
# Enable wildcards
set +f
else else
set -f
./triggers/keywords/keywords.sh "$who" "$from" "$result" ./triggers/keywords/keywords.sh "$who" "$from" "$result"
set +f
fi fi
# "#" would mean it's a channel # "#" would mean it's a channel
if [ "$(echo "$from" | grep '#')" ]; then if [ "$(echo "$from" | grep '#')" ]; then
@ -104,10 +114,14 @@ do
command="${will%% *}" command="${will%% *}"
will="${will#* }" will="${will#* }"
if [ -z "$(ls modules/ | grep -i -- "$command")" ] || [ -z "$command" ]; then if [ -z "$(ls modules/ | grep -i -- "$command")" ] || [ -z "$command" ]; then
set -f
./modules/help/help.sh "$who" "$from" ./modules/help/help.sh "$who" "$from"
set +f
continue continue
fi fi
set -f
./modules/$command/$command.sh "$who" "$from" $will ./modules/$command/$command.sh "$who" "$from" $will
set +f
;; ;;
*) *)
echo "$result" | tee -a "$log" echo "$result" | tee -a "$log"