ISUP *Updated* (for a bot)

By Phatninja55 on Jul 20, 2011

Checks a website with www.isup.me
[!@]is(up|down) website

;Edited by: Jethro
on *:sockopen:isup.*: { 
  tokenize 32 $sock($sockname).mark 
  sockwrite -nt $sockname GET $+(/,$3) HTTP/1.1 
  sockwrite -nt $sockname HOST: $sock($sockname).addr 
  sockwrite -nt $sockname 
} 
on $*:text:/^([!@])is(up|down) (?<=^| )((?>[a-z]{3,6}\072\/\/|w{3}\.)\S+)/Si:#:{
   if !$($+(%,flood.,$nick),2) { 
    set -u6 $+(%,flood.,$nick) on 
    var %sock $+(isup.,$r(0000,9999)) 
    sockopen %sock www.isup.me 80 
    sockmark %sock $iif($regml(1) == @,msg #,notice $nick) $regml(3) 
  } 
} 
on *:sockread:isup.*: { 
  tokenize 32 $sock($sockname).mark 
  var %reader 
  sockread %reader 
  if ($regex(%reader,/(.+)<a href=".+" class="domain">(.+)<\/(a|span)>(.+)/)) { 
    $1-2 $+($chr(3),10,$regml(1),$chr(3),04,$remove($regml(2),</a>),$chr(3),10,$regml(4))
   } 
}

Comments

Sign in to comment.
Savage_CL   -  Aug 04, 2011

ah. My bad :P

 Respond  
Jethro   -  Aug 04, 2011

It is not redundant, Savage_CL. The local variable is set so that the buffer can be stored temporarily for the sockread to read up upon. Without the local variable, the buffer will be stored as a global variable, which occupies a space and is not needed at the end of the task.

 Respond  
Savage_CL   -  Aug 04, 2011
var %isup.reader
  sockread %isup.reader

That's redundant

 Respond  
Are you sure you want to unfollow this person?
Are you sure you want to delete this?
Click "Unsubscribe" to stop receiving notices pertaining to this post.
Click "Subscribe" to resume notices pertaining to this post.