Commits

lan Nomar committed 4f9883a

add bot/autoop

Comments (0)

Files changed (2)

+#!/bin/brc
+
+#2012-03-16 19:08 -!- gylt(~Webis@li354-248.members.linode.com) has joined #bash
+#2012-03-16 21:16 -!- user changed mode/# -> -o touser
+
+
+dir		= $^*
+outF	= $^*/out
+inF		= $^*/in
+chan	= `` (/) { echo -n $* } ; chan = $chan($#chan)
+
+tail -n0 -f $^outF | \
+ while ( true ) {
+  msg=`{ ask }
+   if ( ~ $msg(3) '-!-' && ~ $msg(6) joined ) {
+	user = `` ('(') { echo -n $msg(4) }
+		user = $user(1)
+	echo /MODE $chan +o $user  > $inF
+ } }

bot/autoreply.brc

 
 		w3m -dump definefor.me/^$^* | awk '!/wordnik/ && NR!=1 && NR!=2 && NR!=3 && NR!=4' | sed '10q'
 }
-fn Quote { 
-	if (~ $#* 0) {
-		tail -n1 $dbF
+fn Quote {
+	if ( ~ $#* 0 ) {
+		tail -n1 $^dbF
 	} else {
-		~ $* [0-9] && {
-			awk 'NR=='^$* $dbF 
+		if ( ~ $^* [0-9] [0-9]^[0-9] [0-9]^[0-9]^[0-9] ) {
+			if ( test $qls -ge $* ) {
+				awk 'NR=='^$* $^dbF
+			} else { echo over limit }
 		} || {
-			grep $^* $dbF
+			grep $^* $^dbF
 }	}	}
 
 fn listen { *=`{ rcplayer notify stdout | sed 1q }
 	echo -n 'Listening to:' $^* }
 
 
+
 dir		= $*
 inF 	= $*/in 
 outF	= $*/out
 cmds=(ping linux listen define translate fth fthe Qadd Qlist Quote)
 qls	=	`{ wc -l $dbF }  ; qls=$qls(1)
 
+
+
 fn +1	{ for (* in $*) { $^* = `{ expr 1 + $($^*) } } }
 fn reply	{ echo $^user^: $^* > $^inF }
 fn say		{ shift 5 ; $* > $^inF }
 			case [Qq]^[Ll]ist [Qq][Ll][Ss]
 					echo $^user: There are $qls items on the DB > $inF
 
-			case *
+			case help ayuda
 				echo $user: Solo acepto '(' $cmds ')' > $inF
 		}
 	}