manish

URL Shortener by manish

Dec 26th, 2017
131
0
Never
Not a member of Pastebin yet? Sign Up, it unlocks many cool features!
mIRC 1.67 KB | None | 0 0
  1. ############################################################
  2. ##       URL Shortener      ##
  3. ##       Version: 1.0              ##
  4. ##       By: manish               ##
  5. ##       irc.lunarirc.net   #LunarIRC #LunarGames   User - manish  
  6.   Commands:-
  7. !shorten <URL> : In the channel / Private message the bot
  8. /shorten <URL> : Alias to use yourself
  9. ############################################################
  10. alias isurl return $iif($regex($1-,/\b(\^@\S+|www\.\S+|http://\S+|irc\.\S+|irc://\S+|\w+(?:[\.-]\w+)?@\w+(?:[\.-]\w+)?\.[a-z]{2,4})\b/gi),$iif($prop,$regml($v1),$true))
  11. alias -l tiny {
  12.   if ($1) && ($isurl($1)) {
  13.     set %p 0
  14.     sockclose Tinyurl
  15.     set %TinyurlURL /create.php?source=indexpage&url= $+ $1- $+ &submit=Make+TinyURL%21&alias=
  16.     sockopen Tinyurl tinyurl.com 80
  17.   }
  18.   elseif ( !$isurl($1) ) {
  19.     if (# isin %nick) { msg %nick Invalid url or no url given! }
  20.     else { notice %nick Invalid url or no url given! }
  21.   }
  22. }
  23. on *:TEXT:!shorten*:#: {
  24.   set %nick $chan
  25.   tiny $2-
  26. }
  27.  
  28. alias shorten {
  29.   set %nick $me
  30.   tiny $1-
  31. }
  32.  
  33. on *:TEXT:!shorten*:?:{
  34.   set %nick $nick
  35.   tiny $2-
  36. }
  37.  
  38. on *:SOCKOPEN:Tinyurl: {
  39.   sockwrite -n Tinyurl GET %TinyurlURL HTTP/1.1
  40.   sockwrite -n Tinyurl Host: tinyurl.com
  41.   sockwrite Tinyurl $crlf
  42. }
  43. on *:SOCKREAD:Tinyurl: {
  44.   sockread %Tinyurl
  45.   while ($sockbr) {
  46.     if (<div class="indent"><b> isin %Tinyurl) && (%p == 0) {
  47.       if ($chr(35) isin %nick ) { msg %nick 3 Your URL Has been Shortened To $+ :11 $gettok($right(%Tinyurl,-31),1,60) . }
  48.       else { notice %nick 3 Your URL Has been Shortened To $+ :11 $gettok($right(%Tinyurl,-31),1,60) . }
  49.       unset %p
  50.     }
  51.     sockread %Tinyurl
  52.   }
  53. }
Add Comment
Please, Sign In to add comment