Posted to tcl by hypnotoad at Sat May 05 03:35:05 GMT 2018view raw
- #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
- set result {}
- while {[gets $QuoteSock line]>=0} {
- regsub -all {\<.*\>} $line "" line
- append result $line \n
- }
- putserv "PRIVMSG $chan :\0037[string trimlight $result \n]"
- close $QuoteSock
- return 0
- }
- }