Posted to tcl by hypnotoad at Sat May 05 02:04:35 GMT 2018view pretty
############################################################################################## ## To use this script you must set channel flag +trivia (ie .chanset #chan +trivia) ## ############################################################################################## ############################################################################################## ## ## Start Setup. ## ## ############################################################################################## ## Change trivia_cmdchar to the character you want to use. ## set trivia_cmdchar "!" proc trivia {nick host hand chan args} { if {[lsearch -exact [channel info $chan] +trivia] != -1} { ## Change the characters between the "" below to change the logo shown with each result. ## set trivialogo "\002\00301,11-Trivia-\002\003" ## Change the format codes between the "" below to change the color/state of the text. ## set textf "\0034" ############################################################################################## ## ## End Setup. ## ## ############################################################################################## set triviasite "www.etoyoc.com" set triviaurl "/trivia/text" if {[catch {set triviaSock [socket -async $triviasite 80]} sockerr]} { putserv "PRIVMSG $chan :$triviasite $triviaurl $sockerr error" return 0 } else { puts $triviaSock "GET $triviaurl HTTP/1.0" puts $triviaSock "Host: $triviasite" puts $triviaSock "" flush $triviaSock # Trivia is only ever one line set fact [gets $triviaSock] putserv "PRIVMSG $chan :${textf}[$fact] ${trivialogo}" return 0 } } } proc triviastrip {string} { regsub -all {<[^<>]+>} $string "" string return $string } proc triviadehex {string} { regsub -all {[\[\]]} $string "" string set string [subst [regsub -nocase -all {\&#([0-9]{2});} $string {[format %c \1]}]] return [string map {" \"} $string] } bind pub - [string trimleft $trivia_cmdchar]trivia trivia setudef flag trivia putlog "\002*Loaded* \002\00301,11-Trivia-\002\003 \002Random by Sean Woods, stolen from Ford_Lawnmower irc.GeekShed.net #Script-Help"