Removed some modules.
This commit is contained in:
parent
2e557908bd
commit
7daab60d2a
@ -1,85 +0,0 @@
|
||||
#!/bin/bash
|
||||
|
||||
versionString="azhu® version 2.0.2 by Andrew DiMarco"
|
||||
|
||||
if [ $# == 3 ]; then
|
||||
if [ $3 == "--version" ]; then
|
||||
echo "PRIVMSG $2 :$1: "$versionString
|
||||
exit
|
||||
fi
|
||||
elif [ $# == 1 ]; then
|
||||
if [ $1 == "--version" ]; then
|
||||
echo $versionString
|
||||
exit
|
||||
fi
|
||||
fi
|
||||
|
||||
. "bot.properties"
|
||||
|
||||
lines=$(grep "!azhu" $log)
|
||||
name=$(echo $lines | sed "s/.*\]:\(.*\)![^!]*/\1/g")
|
||||
if [[ "$name" == "" ]]; then
|
||||
name="azhu"
|
||||
fi
|
||||
line=$(echo $lines | sed "s/.*\[\(.*\)\].*/\1/g")
|
||||
lastResponse_DayOfMonth=$(echo $line | sed "s/^.*:.*:\(.*\) .*:.*:.*$/\1/g")
|
||||
|
||||
dayOfWeek=$(date +%a)
|
||||
dayOfMonth=$(date +%d)
|
||||
hour=$(date +%T | sed "s/\([^:]*\):.*/\1/" )
|
||||
minute=$(date +%M)
|
||||
|
||||
daysApart=$((10#$dayOfMonth - 10#$lastResponse_DayOfMonth))
|
||||
if [ "$daysApart" -eq 0 ]; then
|
||||
lastResponse_hour=$(echo $line | sed "s/^.*:.*:.* \(.*\):.*:.*$/\1/g")
|
||||
lastResponse_minute=$(echo $line | sed "s/^.*:.*:.* .*:\(.*\):.*$/\1/g")
|
||||
|
||||
minutesBetween=$(((10#$hour - 10#$lastResponse_hour)*60 + 10#$minute - 10#$lastResponse_minute))
|
||||
fi
|
||||
|
||||
responsePercent=0
|
||||
if [ $minutesBetween -ge 0 ]; then
|
||||
responsePercent=$(( -5000/($minutesBetween+40) - $minutesBetween/25 + 100 ))
|
||||
fi
|
||||
|
||||
percent=0
|
||||
|
||||
case $dayOfWeek in
|
||||
"Mon" )
|
||||
percent=$(($percent+25));;
|
||||
"Tue" )
|
||||
percent=$(($percent+20));;
|
||||
"Wed" )
|
||||
percent=$(($percent+20));;
|
||||
"Thu" )
|
||||
percent=$(($percent+25));;
|
||||
"Fri" )
|
||||
percent=$(($percent+30));;
|
||||
"Sat" )
|
||||
percent=$(($percent+100));;
|
||||
"Sun" )
|
||||
percent=$(($percent+100));;
|
||||
esac
|
||||
|
||||
hp=$((10#$hour*10#$hour*10#$hour/150))
|
||||
|
||||
percent=$((10#$percent+10#$hp+10#$minute/20))
|
||||
percent=$(($percent + $responsePercent))
|
||||
|
||||
|
||||
if [ "$percent" -le 0 ]; then
|
||||
percent=0
|
||||
elif [ "$percent" -ge 100 ]; then
|
||||
percent=99
|
||||
fi
|
||||
|
||||
if [ $# -ge 1 ]; then
|
||||
if [ $1 == "azhu" ]; then
|
||||
percent=0;
|
||||
fi
|
||||
echo "PRIVMSG $2 :$1: There is a $percent% chance $name is sleeping right now."
|
||||
else
|
||||
echo "There is a $percent% chance $name is sleeping right now."
|
||||
fi
|
||||
|
||||
|
@ -1,37 +0,0 @@
|
||||
#! /bin/sh
|
||||
# Simple Question-Answering module
|
||||
# author Vy Nguyen
|
||||
#
|
||||
|
||||
arg1=$1 # sender (the person I am talking to)
|
||||
arg2=$2 # unclear????
|
||||
|
||||
user_dir=modules/talk/logs/$1
|
||||
if [ ! -d "$user_dir" ]; then
|
||||
mkdir $user_dir
|
||||
fi
|
||||
|
||||
# if the user said goodbye and changed her mind!
|
||||
if [ -f "$user_dir/GOODBYE" ]; then
|
||||
echo "PRIVMSG $arg2 :$arg1: I thought you just said goodbye!"
|
||||
rm $user_dir/GOODBYE
|
||||
fi
|
||||
|
||||
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
|
||||
|
||||
# retcode of value 1 means the user said goodbye
|
||||
retcode="${PIPESTATUS[1]}"
|
||||
|
||||
echo "PRIVMSG $arg2 :$arg1: `tail -n 1 $user_dir/output`"
|
||||
|
||||
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`"
|
||||
mv $user_dir/input $user_dir/"input_$stamp"
|
||||
mv $user_dir/output $user_dir/"output_$stamp"
|
||||
# leave good-bye flag (indicating the user already said goodbye)
|
||||
touch $user_dir/GOODBYE
|
||||
fi
|
Binary file not shown.
Loading…
Reference in New Issue
Block a user