Commits

lan Nomar committed b7fd110

autoreply: more elaborate Quote

  • Participants
  • Parent commits b8ca281

Comments (0)

Files changed (1)

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
+	} else {
+		~ $* [0-9] && {
+			awk 'NR=='^$* $dbF 
+		} || {
+			grep $^* $dbF
+}	}	}
+
+fn listen { *=`{ rcplayer notify stdout | sed 1q }
+	echo -n 'Listening to:' $^* }
 
 
 dir		= $*
 
 		switch ( $5 ) {
 
-			case [Pp]^[Ii]^[Nn]^[Gg]
-				reply 'Pong'
-			case linux
-				reply 'Es GNU/Linux'
-			case listen*
-				echo -n 'Listening to:' `{ rcplayer notify stdout | sed 1q } > $^inF
+			case [Pp]^[Ii]^[Nn]^[Gg]	;	reply 'Pong'
+			case [Ll][Ii][Nn][Uu][Xx]	;	reply 'Es GNU/Linux'
+			case listen*				;	listen > $^inF
 
-			case [Dd][Ee][Ff]*
-				shift 5 ; define		$* > $^inF
-			case [Tt][Rr]*
-				shift 5 ; gtranslate	$* > $^inF
+			case [Dd][Ee][Ff]*	; shift 5 ; define $*		> $^inF
+			case [Tt][Rr]*		; shift 5 ; gtranslate $*	> $^inF
 			case 2?? ??2?? ??^'-'^??^2^* *^2^??^'-'^??
 				shift 4 ; gtranslate	$* > $^inF
 
 				ifs=() { *=`{ fth -e $^* } ; echo $^* > $^inF  }
 
 		#( Quotes )#
-			case [Qq]^'uote'
-				awk 'NR=='^$$#* $dbF > $inF
+			case [Qq]^'uote'	;	shift 5 ; Quote $* > $^inF
 			case [Qq][Aa][Dd][Dd]
 					shift 5
 					echo $* '--' added by $user in '('^$^date^')' >> $dbF