Posted to tcl by hypnotoad at Sat May 05 03:35:05 GMT 2018view raw

  1. #Random Quote Script by Ford_Lawnmower irc.mindforge.org #USA-Chat
  2. set quote_cmdchar "!"
  3. bind pub - [string trimleft $quote_cmdchar]quote randomquote
  4. proc randomquote {nick host hand chan args} {
  5. set site "www.quotedb.com"
  6. set url "/quote/quote.php?action=random_quote&=&=&"
  7. set QuoteResult ""
  8. if {[catch {set QuoteSock [socket -async $site 80]} sockerr]} {
  9. putserv "PRIVMSG $chan :$site $url $sockerr error"
  10. return 0
  11. } else {
  12. puts $QuoteSock "GET $url HTTP/1.0"
  13. puts $QuoteSock "Host: $site"
  14. puts $QuoteSock ""
  15. flush $QuoteSock
  16. set result {}
  17. while {[gets $QuoteSock line]>=0} {
  18. regsub -all {\<.*\>} $line "" line
  19. append result $line \n
  20. }
  21. putserv "PRIVMSG $chan :\0037[string trimlight $result \n]"
  22. close $QuoteSock
  23. return 0
  24. }
  25. }