Chuck Norris Facts

By Mr-Juul on Feb 18, 2009

Loads a random quote from www.chucknorrisisgod.com on !chuck :)

alias chuckfact {
  sockopen chuck chucknorrisisgod.com 80
}
on *:SOCKOPEN:chuck: {
  if ($sockerr > 0) {
    return
    sockclose chuck
    %inuse = 0
    echo -a Socket Error.
  }
  else {
    sockwrite -n chuck GET /rand.php HTTP/1.1
    sockwrite -n chuck Host: chucknorrisisgod.com $+ $str($crlf,2)
  }
}
on *:SOCKREAD:chuck: {
  if ($sockerr) {
    halt
  }
  var %text
  sockread %text
  if ($regex(%text,/<td valign='top' nowrap># (\d+)</td><td width='100%' colspan='2'>(.+)</td></tr><tr><td>/i)) {
    msg %chan Random Chuck quote $chr(35) $+ $regml(1) $+ : $regml(2)
    sockclose chuck
    %inuse = 0
  }
}
on *:TEXT:*:#: {
  if ($1- == !chuck) {
    if (%inuse == 0) {
      chuckfact
      %chan = $chan
      %inuse = 1
    }
  }
}

Comments

Sign in to comment.
sercan386   -  Feb 19, 2009

its because he pays androgynous people to write lies about him

 Respond  
Zaff   -  Feb 19, 2009

I don't get why Chuck Norris is so liked...

 Respond  
Mr-Juul   -  Feb 18, 2009

Oh, yup.. Edited :)

 Respond  
Pepsi_Man0077   -  Feb 18, 2009

missing the : in the on text

needs to be

on :TEXT::#: {

other than that, it works fine

 Respond  
Aucun50   -  Feb 18, 2009

That's different

 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.