irc-bot/firebot

38 lines
810 B
Plaintext
Raw Normal View History

2010-12-15 22:36:16 -07:00
#! /bin/sh
firebot () {
read cmd args
case $cmd in
calc)
printf "%s = " "$args"
echo "$args" | bc -l
;;
units)
src=$(echo "$args" | sed 's/ ->.*//')
dst=$(echo "$args" | sed 's/.*-> //')
units -1 -v -- "$src" "$dst"
;;
.note)
who=$(echo $args | cut -d\ -f1 | tr -d -c A-Za-z0-9)
what=$(echo $args | cut -d\ -f2-)
when=$(date)
echo "($when) <$sender> $what" > notes/$who
echo "I've left $who a note, $sender."
;;
*)
exit 1
;;
esac
}
if [ -f notes/$sender ]; then
echo "Welcome back, $sender. Your messages:"
cat notes/$sender
rm notes/$sender
fi
echo "$1" | firebot