Definition v1.0

By Gecko321 on Jun 15, 2012

Looks up the definition of a word

#Looks up definition of word and posts it on channel
bind pub - !def def
proc def {nick host hand chan arg} {

  package require http
  set url "http://lookwayup.com/lwu.exe/lwu/d?s=f&w=$arg"
  set page [http::data [http::geturl $url]]

  regexp {(not found\.|Spelling corrected)} $page a c
  if {[info exists a]} { puts "No Results found for: $arg" }
  if {[regexp {[<b>]} $page a]} {
    set b 0
    putserv "PRIVMSG $chan :Definition of: $arg"
    while {[regexp {<b>(.*?)<\/b>} $page a c]} {
      incr b
      regexp {<b>(.*?)<\/b>} $page a def
      regsub {<b>(.*?)<\/b>} $page "" page
      putserv "PRIVMSG $chan :$b. $def"
    }
  }
}
putlog "Definition v1.0"

Comments

Sign in to comment.
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.