修改MIRC的链接机器人

时间:2014-07-30 18:12:38

标签: mirc

在@Sirius_Black的帮助下,我为MIRC / Twitch设置了这个链接监控机器人。

on @*:text:*:#:linkpost $1-
on @*:action:*:#:linkpost $1-
on @*:notice:*:#:linkpost $1-
alias -l linkpost {
  if (!$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|tv|se|eu|fr|me|nl|de|Q
    var %exception /(?:http?:\/\/)?(?:w{3}\.)?.+(ftr.wot-news|youtu|youtube|\Qimgur\E)\.com|.be/
    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 # /me $nick $+ , you did not have permission to post a link. Type '!permit' to get a mod to allow links for you. Please avoid putting '.it' anywhere in your text.
      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 # /me $$2 $+ , 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 $+ , 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 $+ , Link Protection is already off . $&
        !
    }
  }
}

系统运作非常好。但是,我是否可以添加一个文本命令脚本,允许任何用户输入,例如,键入!link并让机器人响应链接保护是否打开/关闭?

现在,似乎只有一个mod可以打开或关闭机器人(带有消息告诉它打开/关闭)。但有没有办法发出一个命令,其中包含检查僵尸程序是否开启的响应?

很抱歉,如果我是重复的话。

谢谢!

1 个答案:

答案 0 :(得分:0)

使用这一个 键入!链接

on @*:text:*:#:linkpost $1-
on @*:action:*:#:linkpost $1-
on @*:notice:*:#:linkpost $1-
alias -l linkpost {
if (!$hfind(permit,$nick)) {
var %purge /^!(link\so(n|ff)|(permit)|(links))\b/iS
var %domain com|edu|gov|mil|net|org|biz|info|name|museum|us|ca|uk|tv|se|eu|fr|me|nl|de|Q
var %exception /(?:https?:\/\/)?(?:w{3}\.)?.+(ftr.wot-news|youtu|youtube|\Qimgur\E)\.com|.be/
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 # /me $nick $+ , you did not have permission to post a link. Type '!permit' to get a mod to allow links for you. Please avoid putting '.it' anywhere in your text.
  msg # /timeout $nick 1
}
if ($regex($1-,%purge)) && ($regml(1) == links) {
  msg $chan Link Protection for channel $chan is: $iif($istok(%chanon1,$chan,32),on,off)
}
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 # /me $$2 $+ , 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 $+ , 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 $+ , Link Protection is already off . $&
    !
}
}
}