mIRC Home    About    Download    Register    News    Help

Print Thread
Joined: Jan 2014
Posts: 101
M
Majeye Offline OP
Vogon poet
OP Offline
Vogon poet
M
Joined: Jan 2014
Posts: 101
so.. I have link protection that works fine.. but my bot is slowly becoming public and need to make it so if people add regulars, they are added to their channel only.. anyone know how to add that to the following script?


Code:
on $@*:text:*:#:{
  if ($regex($1-,/.+\.(com|co|uk|net|org|gov|tv|edu|fm)/iS)) && ($nick !isop $chan) {
    if (!$istok(%permit,$nick,32)) {
      msg # .timeout $nick 1
      msg $chan Please, $Nick Ask a mod for permission to post links!
    }
  }


  noop $regex($1-,/^!(reg del|reg add|permit)\s(\S+)/iS) { 
    if ($regml(1) == reg add) && ($nick isop $chan) {
      if ($istok(%permit,$regml(2),32)) {
        msg $chan $regml(2) is already on the regular list
      }
      else {
        set %permit $addtok(%permit,$regml(2),32)
        msg $chan $regml(2) You are now always permitted to post links
      }
    }
    if ($regml(1) == permit) && ($nick isop $chan) {
      set %permit $addtok(%permit,$regml(2),32)
      .timerunset 1 30 set %permit $remtok(%permit,$regml(2),1,32)
      msg $chan $regml(2) You have 30 seconds to post a link in here
    }
    if ($regml(1) == reg del) && ($nick isop $chan) {
      if ($istok(%permit,$regml(2),32)) {
        set %permit $remtok(%permit,$regml(2),1,32)
        msg $chan $regml(2) removed from regular list
      }
      else {
        msg $chan $regml(2) is not on regular list
      }
    }
  }
}

Last edited by Majeye; 13/01/15 07:29 AM.
Joined: Jan 2014
Posts: 101
M
Majeye Offline OP
Vogon poet
OP Offline
Vogon poet
M
Joined: Jan 2014
Posts: 101
Belhifet came to my Twitch chat to assist a bit..

I still don't fully understand how to get it to work properly.

Joined: Jun 2014
Posts: 248
B
Fjord artisan
Offline
Fjord artisan
B
Joined: Jun 2014
Posts: 248
Code:
on $@*:text:*:#:{
  if ($regex($1-,/.+\.(com|co|uk|net|org|gov|tv|edu|fm)/iS)) && ($nick !isop $chan) {
    if (!$istok($($+(%,permit.,$chan),2),$nick,32)) {
      msg # .timeout $nick 1
      msg $chan Please, $Nick Ask a mod for permission to post links!
    }
  }
  noop $regex($1-,/^!(reg del|reg add|permit)\s(\S+)/iS)  
  if ($regml(1) == reg add) && ($nick isop $chan) {
    if ($istok($($+(%,permit.,$chan),2),$regml(2),32)) {
      msg $chan $regml(2) is already on the regular list
    }
    else {
      set $+(%,permit.,$chan) $addtok($($+(%,permit.,$chan),2),$regml(2),32)
      msg $chan $regml(2) You are now always permitted to post links
    }
  }
  if ($regml(1) == permit) && ($nick isop $chan) {
    set $+(%,permit.,$chan) $addtok($($+(%,permit.,$chan),2),$regml(2),32)
    set -u30 $+(%,permit.,$chan) $remtok($($+(%,permit.,$chan),2),$regml(2),1,32)
    msg $chan $regml(2) You have 30 seconds to post a link in here
  }
  if ($regml(1) == reg del) && ($nick isop $chan) {
    if ($istok($($+(%,permit.,$chan),2),$regml(2),32)) {
      set $+(%,permit.,$chan) $remtok($($+(%,permit.,$chan),2),$regml(2),1,32)
      msg $chan $regml(2) removed from regular list
    }
    else {
      msg $chan $regml(2) is not on regular list
    }
  }
}


Its possible I made a typo or soemthing in here I didnt test anything, but the idea is...make the variable specific to the channel by naming it dynamically by including the channel name.


Its worth noting

Code:
  if ($regex($1-,/.+\.(com|co|uk|net|org|gov|tv|edu|fm)/iS)) && ($nick !isop $chan) {

the links that are most likely to be abusive links, url shorteners, would bypass your link protection.

Last edited by Belhifet; 13/01/15 09:59 AM.
Joined: Jun 2014
Posts: 248
B
Fjord artisan
Offline
Fjord artisan
B
Joined: Jun 2014
Posts: 248
I'll explain this a little bit.

This is what out variable is
%permit.#majeye belhifet,bob,superbob

$+(%,permit.,$chan)

When we write this, we tell mirc to join these things together. This is called string concatenation. The first thing mirc does is find out what its joining together. In this cause its % and permit. and #majeye (it turns $chan into the channel, this is why we seperated % and permit. because we didn't want it to look for a variable %permit. If we hadn't done this most likely when looking for %permit. it would return $null and join NOTHING with #majeye, resulting in just the channel name.)

When we want to find out what the value of a dynamic variable is we have to tell mirc to evaluate it once its done. We do so by using the evalution identifier, like so $($+(%,permit.,$chan),2).

Remember that %perment.#majeye belhifet,bob,superbob is our variable. When we use evaluation it returns belhifet,bob,superbob. The number we've used..2 is the number of times the statement is evaluated. The first time is when we turn $chan into #majeye, the second time is when we turn %perment.#majeye into belhifet,bob,superbob. We could evaluate it some more by puting the number 3 there. In this case we'd still get belhifet,bob,superbob, but had out result(belhifet,bob,superbob) been 100 + 1 instead...we'd evaluate that to 101.

Last edited by Belhifet; 13/01/15 10:14 AM.
Joined: Jan 2014
Posts: 101
M
Majeye Offline OP
Vogon poet
OP Offline
Vogon poet
M
Joined: Jan 2014
Posts: 101
Wow.. thank you for explaining it so thoroughly. I had to sleep to understand it a bit more. <3

Added a few more to the link protection search wink

Code:
  if ($regex($1-,/.+\.(com|co|uk|net|org|gov|tv|edu|fm|ly|gl|de|rs|gs|eu|ro|gp|sh|in|do|cc|tk|me|uz|nr|biz|to)/iS)) && ($nick !isop $chan) { 

Last edited by Majeye; 13/01/15 04:11 PM.
Joined: Jan 2014
Posts: 101
M
Majeye Offline OP
Vogon poet
OP Offline
Vogon poet
M
Joined: Jan 2014
Posts: 101
Blah.. so the script is still timing people out even after allowing them a permit.

Not sure what is wrong.


Code:
on $@*:text:*:#:{
  if ($regex($1-,/.+\.(com|co|uk|net|org|gov|tv|edu|fm|ly|gl|de|rs|gs|eu|ro|gp|sh|in|do|cc|tk|me|uz|nr|biz|to)/iS)) && ($nick !isop $chan) {
    if (!$istok($($+(%,permit.,$chan),2),$nick,32)) {
      msg # .timeout $nick 1
      msg $chan Please, $Nick Ask a mod for permission to post links!
    }
  }
  noop $regex($1-,/^!(reg del|reg add|permit)\s(\S+)/iS)  
  if ($regml(1) == reg add) && ($nick isop $chan) {
    if ($istok($($+(%,permit.,$chan),2),$regml(2),32)) {
      msg $chan $regml(2) is already on the regular list
    }
    else {
      set $+(%,permit.,$chan) $addtok($($+(%,permit.,$chan),2),$regml(2),32)
      msg $chan $regml(2) You are now always permitted to post links
    }
  }
  if ($regml(1) == permit) && ($nick isop $chan) {
    set $+(%,permit.,$chan) $addtok($($+(%,permit.,$chan),2),$regml(2),32)
    set -u120 $+(%,permit.,$chan) $remtok($($+(%,permit.,$chan),2),$regml(2),1,32)
    msg $chan $regml(2) You have 2 minutes to post a link in here
  }
  if ($regml(1) == reg del) && ($nick isop $chan) {
    if ($istok($($+(%,permit.,$chan),2),$regml(2),32)) {
      set $+(%,permit.,$chan) $remtok($($+(%,permit.,$chan),2),$regml(2),1,32)
      msg $chan $regml(2) removed from regular list
    }
    else {
      msg $chan $regml(2) is not on regular list
    }
  }
}

Last edited by Majeye; 13/01/15 08:43 PM.
Joined: Jan 2014
Posts: 101
M
Majeye Offline OP
Vogon poet
OP Offline
Vogon poet
M
Joined: Jan 2014
Posts: 101
Can anyone spot the error in the script in the post right above this one? Looking to get this one fixed asap.

Joined: Jan 2014
Posts: 101
M
Majeye Offline OP
Vogon poet
OP Offline
Vogon poet
M
Joined: Jan 2014
Posts: 101
Ok so I think I found the culprit.. not sure if its affecting permits and add regs being channel specific.. but here is what I changed.

Code went FROM:
Code:
    set -u120 $+(%,permit.,$chan) $remtok($($+(%,permit.,$chan),2),$regml(2),1,32)
    msg $chan $regml(2) You have 2 minutes to post a link in here


TO this code:
Code:
    .timerunset 1 30 set $+(%,permit.,$chan) $remtok($($+(%,permit.,$chan),2),$regml(2),1,32)
    msg $chan $regml(2) You have 30 seconds to post a link in here


And seems to be working in my own channel so far. Again, not sure if anything is channel specific.. but at least it's working for now.


Link Copied to Clipboard