Commits

lan Nomar committed cdbbdf7

reorganize

Comments (0)

Files changed (6)

Bot/Quotator.brc

-#!/usr/bin/env brc
-# per channel quotator
-
-{ . `{ module.brc std } }
-{ . `{ module.brc Config-IRC } $* }
-
-chan=`{ echo $channels | tr -s ' ' '\n' | dmenu | awk '{ print tolower }' }
-DIR=$^iiDir/$^Server/$chan ; DBFile=$DIR^'/DB'
-echo $DIR '
-' $DBFile '
-' $chan
-exit 0
-
-fn FlushQuotes { Quotes=($Quotes
-$^NewQuote) } ; Quotes=`` ($nl) { cat $DBFile }
-
-tail -f -n1 $DIR^'/out' |\
- while(true) { msg=`{ask}
-  if (~ $msg(4) '@'^* *^[Qq]^uote^*) { Date=($msg(1) $msg(2)) ; User=`{ echo $msg(3) | tr -d '><' }
-   switch($msg(4)){
-	case '@'^[Qq]^'uote'	;	echo $Quotes($msg(5)) >> $DIR^'/in'
-	case '@'^[Aa]^dd^*		;	vshift msg 4	;	NewQuote=($msg '--' $User '('$^Date')')
-		echo $NewQuote >> $DBFile ; FlushQuotes
-	case '@'^*^[Ll]ist		;	echo $User^';' $#Quotes Quotes >> $DIR^'/in' # QuoteList
-	case '@'^[Hh]^elp		;	echo $User^'; cmdlist: Quote AddQuote Quotelist' >> $DIR^'/in'
-} } }
-
-#Use a lot of funcs{}

Bot/autoreply.brc

-#!/usr/bin/env brc
-
-fn define { # this could be a module
-	ifs=$ifs { ifs=()
-        *=`{ urlencode $* } }
-
-		w3m -dump definefor.me/^$^* | awk '!/wordnik/ && NR!=1 && NR!=2 && NR!=3 && NR!=4' | sed '10q'
-}
-
-
-dir = $*
-inF = $*/in 
-outF= $*/out
-
-fn reply { echo $^user^: $^* > $^inF }
-fn say { shift 5 ; $* > $^inF }
-
-tail -f -n0 $^outF |\
-  while ( true ) {
-	*=`{ ask } 
-	if ( ~ $4 *Monevii* ) {
-		user = `` ( '<' '>' ) { echo -n $3 }
-		switch ( $5 ) {
-			case [Pp]^[Ii]^[Nn]^[Gg]
-				reply 'Pong'
-			case linux
-				reply 'Es GNU/Linux'
-			case listening
-				echo -n 'Listening to:' `{ rcplayer notify stdout | sed '1q' } > $^inF
-			case [Dd][Ee][Ff]*
-				shift 5 ; define		$* > $^inF
-			case [Tt][Rr]*
-				shift 5 ; gtranslate	$* > $^inF
-			case [Ff][Tt][Hh]
-				shift 5
-				ifs=() { *=`{ fth -e $^* } ; echo $^* > $^inF  }
-				
-		}
-	}
-}
-
-# { . $BRC^'/Config-Server.brc' }
-# be able to use $nick instead of Monevii
-# it can only listen to 1 file
+#!/usr/bin/env brc
+# per channel quotator
+
+{ . `{ module.brc std } }
+{ . `{ module.brc Config-IRC } $* }
+
+chan=`{ echo $channels | tr -s ' ' '\n' | dmenu | awk '{ print tolower }' }
+DIR=$^iiDir/$^Server/$chan ; DBFile=$DIR^'/DB'
+echo $DIR '
+' $DBFile '
+' $chan
+exit 0
+
+fn FlushQuotes { Quotes=($Quotes
+$^NewQuote) } ; Quotes=`` ($nl) { cat $DBFile }
+
+tail -f -n1 $DIR^'/out' |\
+ while(true) { msg=`{ask}
+  if (~ $msg(4) '@'^* *^[Qq]^uote^*) { Date=($msg(1) $msg(2)) ; User=`{ echo $msg(3) | tr -d '><' }
+   switch($msg(4)){
+	case '@'^[Qq]^'uote'	;	echo $Quotes($msg(5)) >> $DIR^'/in'
+	case '@'^[Aa]^dd^*		;	vshift msg 4	;	NewQuote=($msg '--' $User '('$^Date')')
+		echo $NewQuote >> $DBFile ; FlushQuotes
+	case '@'^*^[Ll]ist		;	echo $User^';' $#Quotes Quotes >> $DIR^'/in' # QuoteList
+	case '@'^[Hh]^elp		;	echo $User^'; cmdlist: Quote AddQuote Quotelist' >> $DIR^'/in'
+} } }
+
+#Use a lot of funcs{}

bot/autoreply.brc

+#!/usr/bin/env brc
+
+fn define { # this could be a module
+	ifs=$ifs { ifs=()
+        *=`{ urlencode $* } }
+
+		w3m -dump definefor.me/^$^* | awk '!/wordnik/ && NR!=1 && NR!=2 && NR!=3 && NR!=4' | sed '10q'
+}
+
+
+dir = $*
+inF = $*/in 
+outF= $*/out
+
+fn reply { echo $^user^: $^* > $^inF }
+fn say { shift 5 ; $* > $^inF }
+
+tail -f -n0 $^outF |\
+  while ( true ) {
+	*=`{ ask } 
+	if ( ~ $4 *Monevii* ) {
+		user = `` ( '<' '>' ) { echo -n $3 }
+		switch ( $5 ) {
+			case [Pp]^[Ii]^[Nn]^[Gg]
+				reply 'Pong'
+			case linux
+				reply 'Es GNU/Linux'
+			case listening
+				echo -n 'Listening to:' `{ rcplayer notify stdout | sed '1q' } > $^inF
+			case [Dd][Ee][Ff]*
+				shift 5 ; define		$* > $^inF
+			case [Tt][Rr]*
+				shift 5 ; gtranslate	$* > $^inF
+			case [Ff][Tt][Hh]
+				shift 5
+				ifs=() { *=`{ fth -e $^* }
+#					~ $#* ????
+				echo $^* > $^inF  }
+			case fthe
+				shift 5
+					*=(: t $* ; t)
+				ifs=() { *=`{ fth -e $^* } ; echo $^* > $^inF  }
+		}
+	}
+}
+
+# { . $BRC^'/Config-Server.brc' }
+# be able to use $nick instead of Monevii
+# it can only listen to 1 file
+#!/usr/bin/env brc
+# Starts ii with a predefined configuration (or not)
+# Start: its 9/18/10 (m/d/y)
+
+{ . `{ module.brc 'Config-IRC' } $* }
+
+~ $#iiDir 0 && iiDir=$HOME'/.local/ii/'$Alias
+
+iiDir=$iiDir/Servers
+#{
+#  if (~ $#flags 1) {
+#	iiDir=$iiDir/$^flags
+#	rm -v $iiDir/in $iiDir/*/in
+#}	}
+
+run=ii
+
+fn cset { ~ $#$1 1 && run=($run -^$2 $$1) }
+
+cset Server s
+cset Port p
+cset iiDir i
+cset Alias n
+cset Alias f
+cset Pass k
+
+echo $run
+
+#( If ii not running, we run, if failed we exit )#
+  if (!pgrep -f $^run > /dev/null) {
+	$run & ; iipid=$apid
+
+		sleep $Sleep
+
+	if (!ps $iipid > /dev/null){
+		echo 'ii not running, exiting' ; exit 1
+}	}
+
+
+if (!~ $Channels) { 
+  for (chan in $Channels) {
+	echo '/j '^$chan > $^iiDir/$Server^'/in'
+} }

ii.brc

-#!/usr/bin/env brc
-# Starts ii with a predefined configuration (or not)
-# Start: its 9/18/10 (m/d/y)
-
-{ . `{ module.brc 'Config-IRC' } $* }
-
-~ $#iiDir 0 && iiDir=$HOME'/.local/ii/'$Alias
-
-iiDir=$iiDir/Servers
-#{
-#  if (~ $#flags 1) {
-#	iiDir=$iiDir/$^flags
-#	rm -v $iiDir/in $iiDir/*/in
-#}	}
-
-run=ii
-
-fn cset { ~ $#$1 1 && run=($run -^$2 $$1) }
-
-cset Server s
-cset Port p
-cset iiDir i
-cset Alias n
-cset Alias f
-cset Pass k
-
-echo $run
-
-#( If ii not running, we run, if failed we exit )#
-  if (!pgrep -f $^run > /dev/null) {
-	$run & ; iipid=$apid
-
-		sleep $Sleep
-
-	if (!ps $iipid > /dev/null){
-		echo 'ii not running, exiting' ; exit 1
-}	}
-
-
-if (!~ $Channels) { 
-  for (chan in $Channels) {
-	echo '/j '^$chan > $^iiDir/$Server^'/in'
-} }