Based on FordLawnmowers verison.
Commands:
!ud - Gives random word definition
!ud - Gives the definition of the word
bind pub - !ud ud
proc ud {nick host hand chan arg} {
package require http
set arg [string map { " " "+" } $arg]
puts $arg
if {[string length $arg] != 0 } { set url "http://www.urbandictionary.com/define.php?term=$arg"
} else {
set url "http://www.urbandictionary.com/random.php"
set page [http::data [http::geturl $url]]
regexp {href="(.*?)"} $page => url
}
set page [http::data [http::geturl $url]]
regexp {'word'>(.*?)<\/td>} $page => word
regexp {definition">(.*?)(<br\/>|<\/div>)} $page => deff
regexp {author">(.*?)<\/a>} $page => author
regexp {example">(.*?)</div>} $page => example
regexp {'not_defined_yet'>} $page => notfound
set deff [string map {" ""} $deff]
set example [string map {" "\""} $example]
regsub -all {(<.*?>)} $example "" example
if {[info exists deff]} {
putserv "PRIVMSG $chan :Word: [string trim $word]"
putserv "PRIVMSG $chan :Definition: [string trim $deff]"
if {[info exists example]} { putserv "PRIVMSG $chan :Example: [string trim $example]" }
putserv "PRIVMSG $chan :By: ([string trim $author]) Link: $url"
}
}
putlog "Urban Dictionary"
Try changing line 16
From:
To: