All pastes #569874 Raw Edit

stats

public text v1 · immutable
·published 2007-06-16 13:23 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 
    set %stats %stats $gettok(%statsn,1,32) $gettok(%statsn,3,32) 
    if ($1 == Consruction) { 
      %rsstats %stats 
      unset %rsstats, %nick, %continue, %stats 
    } 
  } 
  elseif (*overall* iswm %statsn) { 
    tokenize 32 %statsn 
    set %stats $gettok(%statsn,1,32) $gettok(%statsn,3,32) 
    set %continue true 
  } 
}