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

28 lines
470 B
Bash
Raw Normal View History

2009-07-06 17:26:39 +02:00
#!/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
2009-07-07 09:56:53 +02:00
[[ ${LINE} =~ :[a-zA-Z]*!.*(#.*)\ :.* ]] && ORIGIN=${BASH_REMATCH[1]}
2009-07-06 17:26:39 +02:00
echo "${LINE}" | ./shbrain.sh | \
while true
do
read ANSWER || break
echo "--> "$ANSWER
2009-08-18 08:28:39 +02:00
echo "PRIVMSG $ORIGIN :"$ANSWER >&3 3>&3
2009-07-06 17:26:39 +02:00
done
fi
done
exec 3>&-
exit 0