irc-bot/firebot

38 lines
841 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=$(printf "%s" "$args" | sed 's/ ->.*//')
dst=$(printf "%s" "$args" | sed 's/.*-> //')
2010-12-15 22:36:16 -07:00
units -1 -v -- "$src" "$dst"
;;
.note)
who=$(printf "%s" "$args" | sed 's/ .*//;s/[^-A-Za-z0-9]/./')
what=$(printf "%s" "$args" | cut -d\ -f2-)
2010-12-15 22:36:16 -07:00
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