2014-08-27 36 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