More touchups on the main bot's code. No more perl, and now calling the bot by name works again for modules.

This commit is contained in:
Storm Dragon
2016-09-07 08:35:19 -04:00
parent f7abf132ce
commit 203cf6758c
3 changed files with 424 additions and 204 deletions

15
bot.sh
View File

@ -90,15 +90,20 @@ do
# "#" would mean it's a channel
if [ "$(echo "$from" | grep '#')" ]; then
test "$(echo "$result" | grep ":$nick:")" || continue
will="${result#*"${nick}":}"
will="${result#*#*:}"
will="${will#*:}"
else
will="${result#*"${nick}" :}"
will="${result:1}"
will="${will#* :}"
from=$who
fi
will="${will//# /}"
command="${will%% *}"
# Had to turn on globbing to remove all leading whitespace, then turn it off again afterwards.
shopt -s extglob
will="${will##*( )}"
shopt -u extglob
command="${will% *}"
will="${will#* }"
if [ -z "$(ls modules/ | grep -i -- "$com")" ] || [ -z "$com" ]; then
if [ -z "$(ls modules/ | grep -i -- "$command")" ] || [ -z "$command" ]; then
./modules/help/help.sh "$who" "$from"
continue
fi