commented some code

This commit is contained in:
Dimitar Dimitrov 2013-07-17 21:11:00 +01:00
parent 8c3988b2c5
commit 49868ec32c

8
bot.sh
View File

@ -7,10 +7,11 @@ echo "NICK $nick" > $config
echo "USER $user" >> $config echo "USER $user" >> $config
echo "JOIN #$channel" >> $config echo "JOIN #$channel" >> $config
tail -f $config | telnet $server 6667 | while read res; tail -f $config | telnet $server 6667 | while read res
do do
# do things when you see output # do things when you see output
case "$res" in case "$res" in
# respond to ping requests from the server
PING*) PING*)
echo "$res" | sed "s/PING/PONG/" >> $config echo "$res" | sed "s/PING/PONG/" >> $config
;; ;;
@ -18,14 +19,17 @@ do
*"You have not"*) *"You have not"*)
echo "JOIN #$channel" >> $config echo "JOIN #$channel" >> $config
;; ;;
# run when someone joins
*JOIN*) *JOIN*)
who=$(echo "$res" | sed -r "s/:(.*)\!.*@.*/\1/") who=$(echo "$res" | sed -r "s/:(.*)\!.*@.*/\1/")
if [ "$who" = "$nick" ] if [ "$who" = "$nick" ]
then then
continue continue
fi fi
echo "PRIVMSG #$channel :Welcome $who" >> $config echo "PRIVMSG #$channel :Welcome $who, have some op :)" >> $config
echo "MODE #$channel +o $who" >> $config
;; ;;
# run when a message is seen
*PRIVMSG*) *PRIVMSG*)
echo "$res" echo "$res"
who=$(echo "$res" | sed -r "s/:(.*)\!.*@.*/\1/") who=$(echo "$res" | sed -r "s/:(.*)\!.*@.*/\1/")