added what I had done

This commit is contained in:
Dimitar Dimitrov 2013-07-16 23:19:17 +01:00
parent 8202f070e4
commit 943c5b5e3f
2 changed files with 31 additions and 0 deletions

4
bot.properties Normal file
View File

@ -0,0 +1,4 @@
server="irc.freenode.net"
channel="linux"
nick="irc-bash-bot"
user="username hostname servername :realname"

27
bot.sh Executable file
View File

@ -0,0 +1,27 @@
# !/bin/bash
. bot.properties
config=".bot.cfg"
echo "NICK $nick" > $config
echo "USER $user" >> $config
echo "JOIN #$channel" >> $config
tail -f $config | telnet $server 6667 | while read res; do
# do things when you see output
case "$res" in
PING*)
echo "$res" | sed "s/PING/PONG/" >> $config
;;
# for pings on nick/user
*"You have not"*)
echo "JOIN #$channel" >> $config
;;
*JOIN*)
whojoin=$(echo "$res" | sed -r "s/:(.*)\!.*@.*/\1/")
echo "PRIVMSG #$channel :Welcome $whojoin :)" >> $config
;;
*)
echo "$res"
;;
esac
done