mirror of https://github.com/nealey/irc-bot
39 lines
876 B
Bash
Executable File
39 lines
876 B
Bash
Executable File
#! /bin/sh
|
|
|
|
sender=$1
|
|
forum=$2
|
|
|
|
read cmd args
|
|
case $cmd in
|
|
.hi)
|
|
echo "Hi, ASL"
|
|
;;
|
|
.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)
|
|
;;
|
|
.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)
|
|
echo $args | (echo -n "$args = "; bc -l)
|
|
;;
|
|
.units)
|
|
a=$(echo $args | sed 's/->.*//')
|
|
b=$(echo $args | sed 's/.*->//')
|
|
units -v "$a" "$b"
|
|
;;
|
|
*)
|
|
echo "I'm sorry, $sender, I don't understand that command."
|
|
;;
|
|
esac
|