irc-bot/helper

39 lines
876 B
Plaintext
Raw Normal View History

2010-12-09 17:10:06 -07:00
#! /bin/sh
sender=$1
forum=$2
read cmd args
case $cmd in
.hi)
echo "Hi, ASL"
;;
2010-12-10 17:03:24 -07:00
.time)
if [ -n "$args" ]; then
a=$(echo $args | awk '{print "-d " $1}')
fi
echo $(date $a +%s) --- \
$(date $a --rfc-3339=seconds) --- \
$(date $a --utc --rfc-3339=seconds)
2010-12-09 17:10:06 -07:00
;;
.msgme)
echo ":PRIVMSG $sender :hey baby"
;;
.finger)
host="$(echo $args | cut -d@ -f 2)"
[ "$host" = "$args" ] && host=lanl.gov
echo $args | cut -d@ -f 1 | nc $host finger
;;
.calc)
2010-12-10 17:03:24 -07:00
echo $args | (echo -n "$args = "; bc -l)
;;
.units)
a=$(echo $args | sed 's/->.*//')
b=$(echo $args | sed 's/.*->//')
units -v "$a" "$b"
2010-12-09 17:10:06 -07:00
;;
*)
echo "I'm sorry, $sender, I don't understand that command."
;;
esac