All pastes #568833 Raw Edit

rsstats

public text v1 · immutable
·published 2007-06-15 19:59 UTC
rendered paste body
on $*:text:/^[!@](rsstats|stats)/Si:#: { 
  set %rsstats $iif($left($1,1) == @, msg $chan, notice $nick) 
  if ($sock(stats)) %rsstats Please wait, bot is busy. 
  if ( $2- == $null ) { 
    %rsstats You must suply a user: !stats RUNSCAPENAME 
  } 
  else { 
    set %nick $2- 
    sockopen stats parsers.o-ss.net 80 
  } 
} 
on *:SOCKOPEN:stats: { 
  sockwrite -nt $sockname GET /stats.php?user= $+ $replace(%nick,$char(32),+) HTTP/1.1 
  sockwrite -nt $sockname HOST: parsers.o-ss.net
  sockwrite -nt $sockname $crlf 
} 
on *:SOCKREAD:stats: { 
  if ($sockerr) { %rsstats An error has occured while connecting. }
  var %statsn 
  sockread %statsn 
  if (*does* iswm %statsn) {
    %rsstats Sorry, but %nick does not feature in the highscores.
    unset %rsstats %nick
    sockclose $sockname
    unset %style %nick
  }
  elseif (%continue == true) {
    tokenize 32 %statsn
    /bset &stats %stats $bvar(&stats,1,$bvar(&stats,0)) data
    if ($1 == Consruction) {
      %rsstats &stats
      unset %rsstats, %nick, %continue, %stats
    }
  }
  elseif (*overall* iswm %statsn) {
    tokenize 32 %statsn
    set %stats $1 $3
    set %continue true
  }
}