0

With the help of @Sirius_Black I set up this link monitoring bot for 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 . $&
        !
    }
  }
}

The system works fantastically. However, is there a text command script I can add to this that allows any user to, for example, type !link and have the bot respond whether Link Protection is on/off?

Right now, it seems only a mod can turn the bot on or off (with a message telling it's on/off). But is there a way of just sending out a command with the response that checks whether the bot is on/off?

Sorry if I was repetitive.

Thanks!

vika09
  • 19
  • 6

1 Answers1

0

use this one
type !links

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 . $&
    !
}
}
}
Sirius_Black
  • 471
  • 3
  • 11
  • Unfortunately it doesn't seem to work. Neither the new !links nor the previous !link off/!link on works anymore. Should this if statement be outside the existing one? – vika09 Jul 31 '14 at 17:28
  • The !links aspect now works. But it seems as though the actual bot doesn't work. i.e. it's not blocking links now. When I use !link on and !link off; the bot says it's on and off. But it doesn't actually timeout the user who posts a link. This is what happened: http://i.imgur.com/7kQJ0Bv.png – vika09 Jul 31 '14 at 22:54
  • @vika09 i have disabled that for testing sorry, now i have enabled it again, check it out – Sirius_Black Aug 02 '14 at 16:11