From ec7e577dd75f6595a76a74f02c0a8b4cd9113d33 Mon Sep 17 00:00:00 2001
From: julien <julien.dessaux@intersec.com>
Date: Tue, 18 Aug 2009 08:28:39 +0200
Subject: [PATCH] Refactored command handling

---
 shbirth.sh  | 2 +-
 shbot.sh    | 2 +-
 shbrain.sh  | 8 +++++++-
 shbrain.txt | 4 ++--
 4 files changed, 11 insertions(+), 5 deletions(-)

diff --git a/shbirth.sh b/shbirth.sh
index b58c227..894a5c7 100755
--- a/shbirth.sh
+++ b/shbirth.sh
@@ -4,7 +4,7 @@ SERVER=${1:-kro.corp}
 #SERVER=${1:-localhost}
 PORT=6667
 export NICK=shbot
-export CHANNELS=('#codemore #shbot')
+export CHANNELS=('#shbot')
 
 function shbirth ()
 {
diff --git a/shbot.sh b/shbot.sh
index 3a0e7ca..47e3865 100755
--- a/shbot.sh
+++ b/shbot.sh
@@ -18,7 +18,7 @@ do
 		do
 			read ANSWER || break
 			echo "--> "$ANSWER
-			echo "PRIVMSG $ORIGIN :"$ANSWER >&3
+			echo "PRIVMSG $ORIGIN :"$ANSWER >&3 3>&3
 		done
 	fi
 done
diff --git a/shbrain.sh b/shbrain.sh
index 74fc135..6a42feb 100755
--- a/shbrain.sh
+++ b/shbrain.sh
@@ -12,7 +12,13 @@ do
 		EXPAND=(${LINE})
 		CMD=${EXPAND[4]#:}
 		ARGS=${EXPAND[*]:5}
-		if [ "$CMD" = "trains" ]; then
+		if [ "$CMD" = "advert" ]; then
+			echo "PRIVMSG $ARGS :Listen to shbot, the one true Bot"'!' >&3
+		elif [ "$CMD" = "join" ]; then
+			echo "JOIN $ARGS" >&3
+		elif [ "$CMD" = "part" ]; then
+			echo "PART $ARGS" >&3
+		elif [ "$CMD" = "trains" ]; then
 			./shtrains.sh ${ARGS[*]}
 		elif [ "$CMD" = "help" ]; then
 			./shhelp.sh $ARGS
diff --git a/shbrain.txt b/shbrain.txt
index 8a11925..2625847 100644
--- a/shbrain.txt
+++ b/shbrain.txt
@@ -2,8 +2,8 @@ ping	100	pong
 plop	100	pataplop
 :([a-zA-Z]*)!.*:.*(shbot|julien|root).*(le retour|is back)	100	De retour, encore plus fort...
 
-:([a-zA-Z]*)!.*:.*(shbot|julien|root).*(fuck|merde)	100	You, fuck you ${BASH_REMATCH[1]}...
-:([a-zA-Z]*)!.*:.*(clex|galdor).*(fuck|merde|suck)	100	You are right ${BASH_REMATCH[1]}, fuck you ${BASH_REMATCH[2]}.
+:([a-zA-Z]*)!.*:.*(shbot|julien|root).*(fuck|merde|t'es\ moche)	100	You, fuck you ${BASH_REMATCH[1]}...
+:([a-zA-Z]*)!.*:.*(clex|galdor).*(fuck|merde|suck|tu pue)	100	You are right ${BASH_REMATCH[1]}, fuck you ${BASH_REMATCH[2]}.
 :([a-zA-Z]*)!.*:.*([Tt]a.*gueule|tg).*shbot			100	Fuck you ${BASH_REMATCH[1]}...
 :([a-zA-Z]*)!.*:.*(bfb|brainfuck.*bot).*il\ pue		100	Listen to shbot, the one true Bot!
 :([a-zA-Z]*)!.*:.*Who\ are\ you\ shbot			100	The One True Bot!