mirror of https://github.com/nealey/irc-bot
29 lines
599 B
Bash
Executable File
29 lines
599 B
Bash
Executable File
#! /bin/sh -e
|
|
|
|
botdir=$1
|
|
ircdir=$(dirname $0)
|
|
export botdir ircdir
|
|
|
|
# UCSPI wants communication on fd7
|
|
if [ -n "$PROTO" ]; then
|
|
fd=7
|
|
else
|
|
fd=1
|
|
fi
|
|
|
|
if [ -x $botdir/login ]; then
|
|
$botdir/login 1 >& $fd
|
|
else
|
|
nickname=$(cat $botdir/nickname)
|
|
realname=$(cat $botdir/realname 2>/dev/null || \
|
|
echo "I'm a little printf, short and stdout.")
|
|
echo "NICK $nickname" 1 >& $fd
|
|
echo "USER $nickname $nickname $nickname :$realname" 1 >& $fd
|
|
fi
|
|
|
|
if [ -p $botdir/fifo ]; then
|
|
fifo="-f $botdir/fifo"
|
|
fi
|
|
|
|
exec $ircdir/dispatch $fifo $ircdir/irc-filter $botdir/handler
|