Advertisement
westor

Twitch URL Permit (fixed)

Sep 25th, 2015
476
0
Never
Not a member of Pastebin yet? Sign Up, it unlocks many cool features!
mIRC 5.09 KB | None | 0 0
  1. ON !*:TEXT:*:#: {
  2.   tokenize 32 $strip($1-)
  3.   if ($1 == !urlperm) {
  4.     .ignore -cu7 $nick
  5.     if ($nick !isop $chan) { .msg $chan [ $+ $nick $+ ]: You are NOT an channel moderator! | return }
  6.     if (!$2) { .msg $chan [ $+ $nick $+ ]: Error, Not enough parameters, try again and use one of the list! - (List: on,off,add,del,delall,list,total) | return }
  7.     var %st = %urlperm_ [ $+ [ $chan ] ]
  8.     if ($2 == ON) {
  9.       if (%st) { .msg $chan [ $+ $nick $+ ]: The URLs-PERM module is already enabled! }
  10.       elseif (!%st) { set %urlperm_ [ $+ [ $chan ] ] 1 | .msg $chan [ $+ $nick $+ ]: The URLs-PERM module has been enabled! }
  11.     }
  12.     if ($2 == OFF) {
  13.       if (!%st) { .msg $chan [ $+ $nick $+ ]: The URLs-PERM module is already disabled! }
  14.       elseif (%st) { unset %urlperm_ [ $+ [ $chan ] ] | .msg $chan [ $+ $nick $+ ]: The URLs-PERM module has been disabled! }
  15.     }
  16.     if ($2 == add) {
  17.       if ($nick !isop $chan) { .msg $chan [ $+ $nick $+ ]: You are NOT an channel moderator! | return }
  18.       if (!$3) { .msg $chan [ $+ $nick $+ ]: Error, Not enough parameters, try again and enter the nickname! | return }
  19.       var %perms = %urlpermlist_ [ $+ [ $chan ] ]
  20.       if ($istok(%perms,$3,32)) { .msg $chan [ $+ $nick $+ ]: Error, Already exist, this nickname $qt($3) is already into the list! | return }
  21.       if ($4) && ($4 !isnum) { .msg $chan [ $+ $nick $+ ]: Error, Incorrect parameters, try again and enter the seconds but only numbers! | return }
  22.       set %urlpermlist_ [ $+ [ $chan ] ] $addtok(%urlpermlist_ [ $+ [ $chan ] ],$3,32)
  23.       if ($4) { .timer[URL_REMOVE_ $+ $chan $+ _ $+ $3 $+ ] 1 $4 urldel $chan $3 }
  24.       .msg $chan [ $+ $nick $+ ]: The $qt($3) nickname has been added to the URLs exempt list. - Expires on: $iif($4, $+ $duration($4) $+ ,Never)
  25.     }
  26.     if ($2 == del) {
  27.       if ($nick !isop $chan) { .msg $chan [ $+ $nick $+ ]: You are NOT an channel moderator! | return }
  28.       if (!$3) { .msg $chan [ $+ $nick $+ ]: Error, Not enough parameters, try again and enter the nickname! | return }
  29.       var %perms = %urlpermlist_ [ $+ [ $chan ] ]
  30.       if (!$istok(%perms,$3,32)) { .msg $chan [ $+ $nick $+ ]: Error, Not exist, this nickname $qt($3) is NOT into the list! | return }
  31.       set %urlpermlist_ [ $+ [ $chan ] ] $remtok(%urlpermlist_ [ $+ [ $chan ] ],$3,1,32)
  32.       .timer[URL_REMOVE_ $+ $chan $+ _ $+ $3 $+ ] off
  33.       .msg $chan [ $+ $nick $+ ]: The $qt($3) nickname has been removed from the URLs exempt list.
  34.     }
  35.     if ($2 == delall) {
  36.       if ($nick !isop $chan) { .msg $chan [ $+ $nick $+ ]: You are NOT an channel moderator! | return }
  37.       var %perms = %urlpermlist_ [ $+ [ $chan ] ]
  38.       if (!%perms) { .msg $chan [ $+ $nick $+ ]: There is NOT any nickname into the list! | return }
  39.       unset %urlpermlist_ [ $+ [ $chan ] ]
  40.       .timer[URL_REMOVE_ $+ $chan $+ _*] off
  41.       .msg $chan [ $+ $nick $+ ]: The URLs-PERM list for $chan channel have been cleared.
  42.       .msg $chan [ $+ $nick $+ ]: Nick(s): %perms - (Total: $numtok(%perms,32) $+ )
  43.     }
  44.     if ($2 == list) {
  45.       if ($nick !isop $chan) { .msg $chan [ $+ $nick $+ ]: You are NOT an channel moderator! | return }
  46.       var %l = %urlpermlist_ [ $+ [ $chan ] ]
  47.       if (!%l) { .msg $chan [ $+ $nick $+ ]: There is NOT any nickname into the list. | return }
  48.       var %i = 1
  49.       while (%i <= $numtok(%l,32)) {
  50.         var %n = $gettok(%l,%i,32)
  51.         var %tm = $timer([URL_REMOVE_ $+ $chan $+ _ $+ %n $+ ]).secs
  52.         var %nn = %n ( $+ $iif(%tm,%tm $+ s,Never) $+ )
  53.         if (%n) { var %tot = $addtok(%tot,%nn,32) }
  54.         inc %i
  55.       }
  56.       if (%tot) { .msg $chan [ $+ $nick $+ ]: The URLs-PERM list is: %tot }
  57.     }
  58.     if ($2 == total) {
  59.       var %l = %urlpermlist_ [ $+ [ $chan ] ]
  60.       if (!%l) { .msg $chan [ $+ $nick $+ ]: There is NOT any nickname into the list. | return }
  61.       .msg $chan [ $+ $nick $+ ]: The $chan total URLs-PERM nickname list are:  $+ $numtok(%l,32) $+ 
  62.     }
  63.     if ($2 == help) { .msg $chan [ $+ $nick $+ ]: The URLs-PERM module commands are: $1 on/off - $1 add <nick> [seconds] - $1 del <nick> $1 delall - $1 list - $1 total }
  64.   }
  65.   if ($me isop $chan) {
  66.     if (http* iswm $1-) || (www.* iswm $1-) && ($isurl($1-).all) {
  67.       var %perm = %urlpermlist_ [ $+ [ $chan ] ]
  68.       if (!$istok(%perm,$nick,32)) { .msg $chan .timeout $nick 1 }
  69.     }
  70.   }
  71. }
  72.  
  73. alias urldel {
  74.   if (!$1) { return }
  75.   var %perm = %urlpermlist_ [ $+ [ $1 ] ]
  76.   if ($istok(%perm,$2,32)) {
  77.     set %urlpermlist_ [ $+ [ $1 ] ] $remtok(%urlpermlist_ [ $+ [ $1 ] ],$2,1,32)
  78.     if (%urlperm_ [ $+ [ $1 ] ]) { .msg $1 [URLs-PERM]: The nickname $qt($2) has been expired and removed from the exempt list. }
  79.   }
  80. }
  81. alias url_pattern return m@(?:^| )((?:(?:https?|ircs?)://)?(?:(?:[-\w]+\.)+)[-\w]+(?:\d+)?(?:/(?:[-a-zA-Z;/\d#:?=&,]*))?)@ig
  82. alias isurl {
  83.   noop $regex(isurl,$1-,$url_pattern)
  84.   if ($prop == all) {
  85.     var %a 1,%url
  86.     while ($regml(isurl,%a) != $null) {
  87.       %url = %url $v1
  88.       inc %a
  89.     }
  90.     return $iif(%url,%url,0)
  91.   }
  92.   return $iif($prop isnum 0-,$regml(isurl,$prop),$iif($regml(isurl,0),$true,$false))
  93. }
Advertisement
Add Comment
Please, Sign In to add comment
Advertisement