在@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 /^!(linkso(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|QimgurE).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 . $&
!
}
}
}
这个系统工作得非常好。但是,是否有一个文本命令脚本,我可以添加到此,允许任何用户,例如,键入!链接,并有机器人响应链接保护是否打开/关闭?
现在,似乎只有一个mod可以打开或关闭bot(有一个消息告诉它是打开/关闭)。但是,是否有一种方法可以发送一个命令,并响应检查机器人是否打开/关闭?
如果我重复了,对不起。
谢谢!
使用这个
链接类型!
on @*:text:*:#:linkpost $1-
on @*:action:*:#:linkpost $1-
on @*:notice:*:#:linkpost $1-
alias -l linkpost {
if (!$hfind(permit,$nick)) {
var %purge /^!(linkso(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|QimgurE).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 . $&
!
}
}
}