Commits

lan Nomar committed 086d8a5

Quotator merged with autoreply

Comments (0)

Files changed (1)

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{}