fixed talk errors

This commit is contained in:
Dimitar Dimitrov 2013-07-22 17:16:31 +01:00
parent 509a51f967
commit 9ac2cf758c
2 changed files with 5 additions and 3 deletions

4
bot.sh
View File

@ -40,7 +40,9 @@ do
will=$(echo "$res" | perl -pe "s/.*$nick :(.*)/\1/")
from=$who
fi
com=$(echo "$will" | cut -d " " -f 2)
will=$(echo "$will" | perl -pe "s/^ //")
com=$(echo "$will" | cut -d " " -f1)
echo "COM:$com"
if [ -z "$(ls modules/ | grep -i -- "$com.sh")" ]
then
./modules/help.sh $who $from >> $input

View File

@ -17,7 +17,7 @@ if [ -f "$user_dir/GOODBYE" ]; then
rm $user_dir/GOODBYE
fi
shift 3 # chop off the first two args
shift 2 # chop off the first two args
echo "$@" >> $user_dir/input
cat $user_dir/input | java -jar modules/talk/talk_bot.jar > $user_dir/output
@ -26,7 +26,7 @@ retcode="${PIPESTATUS[1]}"
echo "PRIVMSG $arg2 :$arg1: `tail -n 1 $user_dir/output`"
if [ $retcode -eq "1" ]; then
if [ "$retcode" -eq "1" ]; then
echo "PRIVMSG $arg2 :$arg1: That was a joke! It's free to talk to me. But we do accept donations! ;D"
# clean up old conversations
stamp="`date +%s`"