I took a stab at a TCL script for Eggdrop that takes a URL parameter, queries the TinyURL server, then spits back out the converted URL.
Code: Select all
##
## tinyurl.tcl
## An Eggdrop interface to http://tinyurl.com/
##
## Ray Van Dolson (rayvd@bludgeon.org)
## v1.0
##
package require http
bind pub - !tinyurl tinyurl
proc tinyurl {nick host handle chan args} {
if {[lindex $args 0] != ""} {
set user_url [lindex $args 0]
set url "http://tinyurl.com/create.php"
set postdata [http::formatQuery url $user_url submit submit]
set data [http::geturl $url -query $postdata]
set data2 [http::data $data]
http::cleanup $data
foreach line [split $data2 \n] {
if {[regexp -nocase {<blockquote>(http://tinyurl.com/.*)<\/blockquote>} $line all_matches myurl]} {
putserv "PRIVMSG $chan :$myurl"
}
}
}
}