Requested script.
Script gets a random quote from www.quotedb.com and returns it to the channel. Trigger is !quote.
You can change the command char to what ever you want on line 2. -->> set quote_cmdchar "!"
Example Output:
20:18:32 !quote
20:18:33 A truly great book should be read in youth again in maturity and once more in old age as a fine building should be seen by morning light at noon and by moonlight. by Robertson Davies
#Random Quote Script by Ford_Lawnmower irc.mindforge.org #USA-Chat
set quote_cmdchar "!"
bind pub - [string trimleft $quote_cmdchar]quote randomquote
proc randomquote {nick host hand chan args} {
set site "www.quotedb.com"
set url "/quote/quote.php?action=random_quote&=&=&"
set QuoteResult ""
if {[catch {set QuoteSock [socket -async $site 80]} sockerr]} {
putserv "PRIVMSG $chan :$site $url $sockerr error"
return 0
} else {
puts $QuoteSock "GET $url HTTP/1.0"
puts $QuoteSock "Host: $site"
puts $QuoteSock ""
flush $QuoteSock
while {![eof $QuoteSock]} {
set QuoteVar " [gets $QuoteSock] "
if {[regexp {document\.write\('(.*)'} $QuoteVar match QuoteResult]} {
regsub -all {\<.*\>} $QuoteResult "" QuoteResult
}
if {[regexp {authors\/.*">(.*)<\/a><\/i>'\);} $QuoteVar match QuoteAuthor]} {
putserv "PRIVMSG $chan :\0037$QuoteResult - \0034by $QuoteAuthor"
break
}
}
close $QuoteSock
return 0
}
}
it's a nice tcl, but I'm not able to get it work.
I'm running it on latest eggdrop