2014-08-27 79 views
0

我發現Sirus_Black發佈了以下腳本。但我有一個問題,我希望他,或任何人都可以啓發我。mIRC鏈接保護[編輯腳本]

on @*:text:*:#:linkpost $1- 
on @*:action:*:#:linkpost $1- 
on @*:notice:*:#:linkpost $1- 
alias -l linkpost { 
    if ((!%p) && (!$hfind(permit,$nick))) { inc -u4 %p 
    var %purge /^!(link\so(n|ff)|(permit))\b/iS 
    var %domain com|edu|gov|mil|net|org|biz|info|name|museum|us|ca|uk 
    var %exception /(?:https?:\/\/)?w{3}\.(youtube|imgur)\.com/ 
    var %link /(?<=^|\s)((?>\S{3,8}:\/\/|w{3}\56)\S+)|\56($+ %domain $+)\b/iS 
    if ($findtok(%chanon1,#,1,32)) && ($nick(#,$nick,vr)) && ($regex($1-,%link)) && (!$regex($1-,%exception)) { 
     timeout 30 # $nick | /mode # -b $nick 
     msg # $nick You did not have permission to post a link ask a mod to !permit you 
     msg # /timeout $nick 1 
    } 
    elseif (($regex($1-,%purge)) && ($regml(1) = permit) && ($nick isop #) && ($$2 ison #)) { 
     hadd -mz permit $v1 30 | notice $v1 You have 30 seconds to post a link. Starting now! 
     msg # You now have 30 seconds to post a link! 
    } 
    elseif (($regml(1) = link on) && ($nick isop #)) { 
     goto $iif(!$istok(%chanon1,#,32),a,b) | :a | set %chanon1 $addtok(%chanon,#,32) 
     .msg # Link Protection Is Now on in: $+($chr(2),#) 
     halt | :b | .msg # $nick $+ , my link protection is already on in $& 
     $+($chr(2),#,$chr(2)) ! 
    } 
    elseif (($regml(1) = link off) && ($nick isop #)) { 
     goto $iif($istok(%chanon1,#,32),c,d) | :c | set %chanon1 $remtok(%chanon,#,1,32) 
     .msg # Link Protection Is Now off in: $+($chr(2),#) 
     halt | :d | .msg # $nick $+ , My link protection is already off . $& 
     ! 
    } 
    } 
} 

該腳本按預期工作,但我對如何添加它的有限知識苦苦掙扎。

說我想對其他一些網站做例外。

test1.tv test2.eu和ima.ninja

我可以想象,這將是在更換變線,以簡單:

var %exception /(?:https?:\/\/)?w{3}\.(test1|test2|ima)\.com/|\.tv|\.eu|\.ninja 

但是,當我嘗試這樣做,即使是那些鏈接會導致超時。

更新:好吧,我再

var %exception /(?:https?:\/\/)?w{3}\.(test1|test2|ima)\.com/|\.tv|\.eu|\.ninja 

測試了這允許我使用test1.tv,因爲我想要的,但http://test1.tv導致超時。我還注意到,只要http://不存在,就可以使用任何.eu和.tv網站。

/brainfart

回答

0

試試這個

on @*:text:*:#:linkpost $1- 
on @*:action:*:#:linkpost $1- 
on @*:notice:*:#:linkpost $1- 
alias -l linkpost { 
if ((!%p) && (!$hfind(permit,$nick))) { 
var %purge /^!(link\so(n|ff)|(permit))\b/iS 
var %domain com|edu|gov|mil|net|org|biz|info|name|museum|us|ca|uk 
var %exception /https?:\/\/(?:w{3})?\.(youtube|imgur|ima|test)\.(ninja|eu|com)/ 
var %link /(?<=^|\s)((?>\S{3,5}:\/\/|w{3}\56)\S+)|\56($+ %domain $+)\b/iS 
if ($findtok(%chanon1,#,1,32)) && ($nick(#,$nick,vr)) && ($regex($1-,%link)) && (!$regex($1-,%exception)) { 
    timeout 30 # $nick | /mode # -b $nick 
    msg # $nick You did not have permission to post a link ask a mod to !permit you 
    msg # /timeout $nick 1 
} 
elseif (($regex($1-,%purge)) && ($regml(1) = permit) && ($nick isop #) && ($$2 ison #)) { 
    hadd -mz permit $v1 30 | notice $v1 You have 30 seconds to post a link. Starting now! 
    msg # You now have 30 seconds to post a link! 
} 
elseif (($regml(1) = link on) && ($nick isop #)) { 
    goto $iif(!$istok(%chanon1,#,32),a,b) | :a | set %chanon1 $addtok(%chanon,#,32) 
    .msg # Link Protection Is Now on in: $+($chr(2),#) 
    halt | :b | .msg # $nick $+ , my link protection is already on in $& 
    $+($chr(2),#,$chr(2)) ! 
} 
elseif (($regml(1) = link off) && ($nick isop #)) { 
    goto $iif($istok(%chanon1,#,32),c,d) | :c | set %chanon1 $remtok(%chanon,#,1,32) 
    .msg # Link Protection Is Now off in: $+($chr(2),#) 
    halt | :d | .msg # $nick $+ , My link protection is already off . $& 
    ! 
} 
} 
} 
+0

非常感謝回去我。我很感激這方面的幫助,我希望我可以多問一點。 您所做的修復確實是解決方案。我現在面臨的唯一問題是充分鏈接。我的意思是,如果我想把youtube鏈接,我不能簡單地把youtube.com/siriusisawesome。我需要包括http://www.youtube.com/siriusisawesome 有沒有辦法使http:// www。可選的?或者讓子域名可以接受? 例如:http:/ /sub.test.eu或者只是sub.test.eu 再一次,我真的很感謝幫助。 – jimieo 2014-08-29 04:30:25

+0

我的意思是我需要包括http://和www。 – jimieo 2014-08-29 04:40:12

+0

試試這個正則表達式匹配 /(?:(?<=w{3}\.|http:\/\/))(\S+\.(?:com|eu|uknetnet))/ – 2014-08-30 00:38:08