Simply attach this to your bot and whenever people type !tiny their urls will become tinyurl version.
on *:TEXT:!tiny*:#: { msg $chan Congratulations $nick $+ ! Your current url of $2 has been shortened at http://tinyurl.com/create.php?source=indexpage&url= $+ $2 $+ &submit=Make+TinyURL!&alias= Thank you for using the script! }
Well anyways nice work... and yeah it does indeed work... was just trying to show a other way to go about it.
First of all $strip($2) is pretty important in cases it's a link copied with color ect. not sure it will give the right link if you don't use strip. - But didn't test it...
And instead of using
http://tinyurl.com/create.php?source=indexpage&url= $+ $2 $+ &submit=Make+TinyURL!&alias=
you could use
$+(http://tinyurl.com/create.php?source=indexpage&url=,$2,&submit=Make+TinyURL!&alias=)
Looks cleaner I think... but the script does what it's suppose to ;D
on *:TEXT:!tiny*:#: {
if (http !isin $1-) || (. !isin $1-) { msg # ERROR! - Might just be Me... but $+(,$strip($2),) doesn't seem to be a link ? | halt }
msg # Congratulations $+($nick,!) Your current url of $+(,$strip($2),) has been shortened at $+(2,http://tinyurl.com/create.php?source=indexpage&url=,$strip($2),&submit=Make+TinyURL!&alias=,) - Thank's for using the script! }
NOTE: Above script is written here... it's not tested ( should still work ) it's just an example on how to go about it.
It would indeed require a socket, I haven't looked at the use of sockets either.
Idiot proof scripts are the way of the future.
Strip and flood timer:
on *:TEXT:!tiny*:#: {
if (%flood_protection_tiny != on) {
var %url $strip($2)
msg $chan Congratulations $nick $+ ! Your current url of %url has been shortened at http://tinyurl.com/create.php?source=indexpage&url= $+ %url $+ &submit=Make+TinyURL!&alias= Thank you for using the script!
set %flood_protection_tiny on
timer 1 3 unset %flood_protection_tiny
}
else msg $chan Please do not spam this command!
}
Also, do you want the custom alias bit added? Not too hard...
Haha... not at all what I thought it was :P
Anyways... nice work I guess... was just about to post one with $replace(r) :P
on *:TEXT:!tiny*:#: { msg # Congratulations $+($nick,!) Your current url of $+(,$strip($2),) has been shortened at $+(2,http://tinyurl.com/create.php?source=indexpage&url=,$strip($2),&submit=Make+TinyURL!&alias=,) - Thank's for using the script! }
Any chance of making this work on a BOT so it will fetch the tiny URL automatically ?
I know this is quite a old thread, but is there a way to get the link to display in the room without having to go to the site to get it?