Archived
1
0
Fork 0
This repository has been archived on 2025-03-10. You can view files and clone it, but cannot push or open issues or pull requests.
shbot/shbot.sh
2009-08-19 12:22:40 +02:00

27 lines
470 B
Bash
Executable file

#!/bin/bash
source ./shbirth.sh
exec 3<>/dev/tcp/$SERVER/$PORT
shbirth 1>&3
while true
do
read LINE 0<&3 || break
echo "<-- "$LINE
if [[ "$LINE" =~ PING\ *:(.*) ]]; then
echo "PONG :${BASH_REMATCH[1]}" >&3
else
[[ ${LINE} =~ :[a-zA-Z]*!.*(#.*)\ :.* ]] && ORIGIN=${BASH_REMATCH[1]}
echo "${LINE}" | ./shbrain.sh | \
while true
do
read ANSWER || break
echo "--> "$ANSWER
echo "PRIVMSG $ORIGIN :"$ANSWER >&3 3>&3
done
fi
done
exec 3>&-
exit 0