Advertisement
Not a member of Pastebin yet?
Sign Up,
it unlocks many cool features!
- ;URLShorten Script (Shorten Long Links) v1.0
- ;Made by nick1
- ;Last edit August 13 2011
- ;Directions: !shorten LINK (notice) @shorten LINK (Message) /shorten LINK private to yourself
- alias checkifsockopen {
- if ($sock(%checksockname)) { sockclose %checksockname
- if (%_bq.msgtype) %_bq.msgtype $+(12[4,URL,12])10 Error Encountered! |unset %_bq.*
- }
- }
- alias nohtml { return $regsubex($$1-,/^[^<]*>|<[^>]*>|<[^>]*$/g,) }
- alias urlencode return $replace($regsubex($$1-,/([^\w\s])/Sg,$+(%,$base($asc(\t),10,16,2))),$chr(32),+)
- on $*:text:/^[!@](tiny|shorten|bq)/Si:#: {
- if ($($+(%,botflood.,$nick),2)) {
- if ($($+(%,botflood.,$nick),2) >= 50) { ignore -u60 $address($nick,0) | msg $chan $+($nick,$chr(44)) You Have Been Put On Ignore For 60secs For Abusing The Bot. | halt }
- elseif ($($+(%,botflood.,$nick),2) >= 40) { msg $chan $+($nick,$chr(44)) Please Do Not Abuse The Bot. | inc -z $+(%,botflood.,$nick) 20 | halt }
- else { inc -z $+(%,botflood.,$nick) 25 }
- }
- else { inc -z $+(%,botflood.,$nick) 25 }
- if ($sock(bq)) { msg $chan $nick $+ : Please wait, already working on a URL. | halt }
- elseif (nick1 ison $chan) { halt }
- set %_bq.nick $nick
- inc %shortens
- set %_bq.msgtype $iif($left($1,1) == @, msg $chan, notice $nick)
- set %_bq.url $2-
- sockopen bq ou.gs 80
- }
- alias shorten {
- if ($isid) {
- if (%_bq.shortlink) {
- var %i %_bq.shortlink
- unset %_bq.*
- return %_bq.shortlink
- }
- else {
- set %_bq.isid true
- set %_bq.msgtype echo -ac info
- set %_bq.url $1-
- sockopen bq ou.gs 80
- }
- }
- elseif ($2) {
- set %_bq.nick $1
- inc %shortens
- set %_bq.msgtype $iif((!%_bq.msgtype),msg $active,%_bq.msgtype)
- set %_bq.url $2-
- sockopen bq ou.gs 80
- }
- elseif ($2 == $null) {
- set %_bq.msgtype echo -ac info
- set %_bq.url $1-
- sockopen bq ou.gs 80
- }
- }
- on *:sockopen:bq: {
- .timerSet 1 4 set %checksockname $sockname
- .timerCheck 1 5 checkifsockopen
- if (%_bq.lmgtfy) { sockwrite -nt $sockname GET /index.php?url= $+ %_bq.url $+ &alias= $+ %_bq.nick $+ -G0- $+ %shortens HTTP/1.1 }
- else { sockwrite -nt $sockname GET /index.php?url= $+ $urlencode(%_bq.url) HTTP/1.1 }
- sockwrite -nt $sockname Host: ou.gs
- sockwrite -nt $sockname $crlf
- }
- on *:SOCKREAD:bq: {
- if ($sockerr) { echo -a SOCKET ERROR: $sockerr | halt }
- else {
- var %sockreader
- sockread %sockreader
- if (*<p>Short URL: <strong><a href="* iswm %sockreader) {
- if (%_bq.lmgtfy) {
- %_bq.msgtype %_bq.nick $+ : 12[4Helpful Link12] http://ou.gs/ $+ %_bq.nick $+ -G0- $+ %shortens
- unset %_bq.*
- sockclose $sockname
- halt
- }
- if (%_bq.isid) {
- tokenize 34 %sockreader
- set %_bq.shortlink $2
- shorten
- sockclose $sockname
- halt
- }
- else {
- %_bq.msgtype 10 $+ Long URL: $iif($left(%_bq.url,7) == http://,%_bq.url,http:// $+ %_bq.url) ( $+ $len($iif($left(%_bq.url,7) == http://,%_bq.url,http:// $+ %_bq.url)) Characters) Is4 $nohtml(%sockreader)
- }
- unset %_bq.*
- sockclose $sockname
- }
- }
- }
Advertisement
Add Comment
Please, Sign In to add comment
Advertisement