What it does: Returns a TinyURL to the user/channel.
Usage: !tinyurl http://URL.com - Either you or someone else can say this in a channel and the tinyurl will be returned to the channel.
Also; /tinyurl http://URL.com will echo the tinyurl to the active window
;;TinyURL
on *:TEXT:!tinyurl &:#:{ if (%tinyspam) { halt }
set -u3 %tinyspam 1
set %tinyurlchan $chan
set %tinyurl1 $2
if ($sock(tinyurl)) { sockclose tinyurl }
sockopen tinyurl tinyurl.com 80
}
on *:INPUT:#:{
if (!tinyurl == $1 && $2 != $null && %tinyspam == $null) {
set -u3 %tinyspam 1
set %tinyurlchan $chan
set %tinyurl1 $2
if ($sock(tinyurl)) { sockclose tinyurl }
sockopen tinyurl tinyurl.com 80
} }
alias tinyurl {
set -u3 %tinyspam 1
set %tinyurl1 $1
if ($sock(tinyurl)) { sockclose tinyurl }
sockopen tinyurl tinyurl.com 80
}
on *:sockopen:tinyurl:{
sockwrite -n $sockname GET /create.php?url= $+ %tinyurl1 HTTP/1.0
sockwrite -n $sockname Host: tinyurl.com
sockwrite -n $sockname user-agent: Mozilla/??
sockwrite -n $sockname Connection: Keep-Alive
sockwrite -n $sockname $crlf
}
on 1:sockread:tinyurl:{
:nextread
if ($sockerr > 0) return
sockread %temp
if ($sockbr == 0) return
if (<blockquote><b>* iswm %temp && $left($replace(%tinyurl1,&,&),15) !isin %temp) {
set %tinyurl2 $remove($gettok(%temp,2,60),b>)
if (%tinyurlchan) { msg %tinyurlchan Shortened %tinyurl1 to %tinyurl2 }
else { echo -a Shortened %tinyurl1 to %tinyurl2 }
unset %tinyurl*
}
goto nextread
}
Hi, I tried this script as it seems a good idea, but there\'s just one thing not quite right. If someone in a channel you\'re not active in uses the script, it doesn\'t give them the shortened URL, it just repeats the URL they wanted to shorten. Example:
!tinyurl http://www.youtube.com/watch?v=o1O7ZvDFP_8&NR [@aceman] Shortened http://www.youtube.com/watch?v=o1O7ZvDFP_8&NR to http://www.youtube.com/watch?v=o1O7ZvDFP_8&NR In the channel I\'m active in: \'Shortened to http://tinyurl.com/ez2a7\' It messages the shortened URL to me, but not the person that wanted it. It\'s a good script and quite handy to use, you just need to change how it announces the tinyurl to the person. :)