用于Twitch的mIRC Link Bot

时间:2014-07-04 18:23:23

标签: mirc

这是一篇相当长的帖子(特别是下面的代码),所以请耐心等待。

在@Siris_Black的帮助下,我设法让这件事发挥作用。

//LINK PROTECTION
    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|tv
        var %exception /(?:http?:\/\/)?w{3}\.(youtube|imgur|i.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 $+ , 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 . $&
            !
        }
      }
    }

然而,即使使用广泛的脚本,也存在一些问题:

&#39;白名单&#39;被阻止的链接

http://i.stack.imgur.com/Ww4rK.png

正如你所看到的,Alexander_CJ和Psychosis06发布了Imgur链接并且是timedout(我有BetterTwitchTV,所以我可以透露被清除的内容)。我在这里错误地设置了什么东西吗?

!permit命令并不总是有效 似乎有许多命令无法实际允许任何人的问题。主要问题是用户名(我发现:所有用户名都是小写)。但是!permit + username命令似乎仍然存在问题。这里是否存在任何冲突?

链接脚本允许某些链接在其之前或之后包含文本

这是非常自我解释的,有些情况下,链接机器人允许链接似乎在它之后或之前具有正常文本。除非我没有正确设置规则,否则会出现问题。

链接保护似乎会干扰其他脚本

这些是我的其他脚本:

//Commands
on *:TEXT:!commands:#circon: { 
  if ((%floodcommands) || ($($+(%,floodcommands.,$nick),2))) { return }
  set -u5 %floodcommands On
  set -u15 %floodcommands. $+ $nick On
  msg $chan /me Currently available commands (place a '!' before the word) - donate|song|mods. Please don't spam commands. $+
}

//Song
on *:TEXT:!song:#circon: { 
  if ((%floodsong) || ($($+(%,floodsong.,$nick),2))) { return }
  set -u5 %floodsong On
  set -u15 %floodsong. $+ $nick On
  msg $chan /me You can find Circon's songs here, wait for the song to finish and it will be the last played song: http://grooveshark.com/#!/circonflexes/listens $+
}

//Soccer Link
on *:TEXT:!football:#circon:{
  if ((%floodfootball) || ($($+(%,floodfootball.,$nick),2))) { return }
  set -u5 %floodfootball On
  set -u15 %floodfootball. $+ $nick On
  msg $chan /me Circon is watching the World Cup here!: <LINK> $+
} 

//Mods Link
on *:TEXT:!mods:#circon:{
  if ((%floodmods) || ($($+(%,floodmods.,$nick),2))) { return }
  set -u5 %floodmods On
  set -u15 %floodmods. $+ $nick On
  msg $chan /me Circon's mods are here: http://youtu.be/N-IHaIKQvns. Servercross2 Recticle add-on - https://www.dropbox.com/s/dkd0b1fqp9oaz2e/ServerCross2.rar Dont forget to virus scan before use. :) $+
}

//Donate
on *:TEXT:!donate:#circon:{
  if ((%flooddonate) || ($($+(%,flooddonate.,$nick),2))) { return }
  set -u5 %flooddonate On
  set -u15 %flooddonate. $+ $nick On
  msg $chan /me Please donate to Circon here: https://www.paypal.com/cgi-bin/webscr?cmd=_s-xclick&hosted_button_id=KRQXH2YM3WGSW $+
}

偶尔输入正确的命令(即!歌曲)将不会显示文本。事实上,没有任何反应。有什么相互矛盾的吗?我无法看到我所做的任何问题。有两组这些脚本(用于两个Twitch通道)。

对不起,这很多。我是MSL的新手,只需要一些指示/提示。我主要感谢任何关于建立最严格的链接保护的指导 - 即除了youtube和imgur之外不允许任何链接。

谢谢!

1 个答案:

答案 0 :(得分:0)

首先,另一个文本脚本(!命令,!song,!footbal,!mods)需要在另一个远程文件中 因为你有一个文本脚本匹配链接保护脚本

上的任何内容

试试这个

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
var %exception /(?:http?:\/\/)?(?:w{3}\.)?.+(youtube|\Qimgur\E)\.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 # $$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 . $&
    !
}
}
}