Posted to tcl by hypnoyoad at Sat May 05 03:45:02 GMT 2018view pretty

#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.etoyoc.com"
  set url "/trivia/text"
  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 
  }
}