#################################################### # Rating # #################################################### # 1 : notice $nick # 2 : privmsg $nick # 3 : privmsg $channel set cricketmethod 1 ### Events bind pub - "!rating" rating package require http proc rating {nick uhost handle channel text} { switch -- [string tolower [lindex [split $text] 0]] { odi { rating:download $nick $channel odi } test { rating:download $nick $channel test } default { putquick "NOTICE $nick :Commands:" putquick "NOTICE $nick :!rating ODI" putquick "NOTICE $nick :!rating TEST" } } } proc rating:download {nick chan class} { global data switch -exact -- $::cricketmethod { "1" {set method "notice" ; set who "$nick"} "2" {set method "privmsg" ; set who "$nick"} "3" {set method "privmsg" ; set who "$chan"} } set url "http://icc-cricket.yahoo.com/rankings/rankings.html" set data [getwebdata $url] if {$data==0} { putserv "$method $who :There was an error fetching the data. Contact an admin to report this or try again later." return } set foundstart 0 foreach line [split $data \r\n] { if {[string match -nocase "
" $line]} { set word "\037\002[string range $line [expr 40 + [string length $class] -3] [expr [string length $line]-11]]\002\037" putserv "$method $who :$word" set foundstart 1 set output "" } elseif {$foundstart && [string match -nocase {