irc-bot/bot

25 lines
536 B
Plaintext
Raw Normal View History

2011-06-09 21:27:24 -06:00
#! /bin/sh -e
2011-01-07 13:03:16 -07:00
2011-06-09 21:27:24 -06:00
botdir=$1
d=$(dirname $0)
nickname=$(cat $botdir/nickname)
realname=$(cat $botdir/realname 2>/dev/null || \
echo "I'm a little printf, short and stdout.")
export nickname realname
2011-01-07 15:50:36 -07:00
(
# UCSPI wants input on FD 7, and sets $PROTO
[ -n "$PROTO" ] && exec 1>&7
2011-06-09 21:27:24 -06:00
if [ -x $botdir/login ]; then
$botdir/login
else
echo "NICK $nickname"
echo "USER $nickname $nickname $nickname :$realname"
fi
2011-01-07 15:50:36 -07:00
)
2011-06-09 21:27:24 -06:00
mkfifo -m 0600 $botdir/fifo
2011-01-28 13:09:55 -07:00
2011-06-09 21:27:24 -06:00
exec $d/dispatch -f $botdir/fifo $d/irc $botdir/handler