mIRC Home    About    Download    Register    News    Help

Print Thread
#272683 10/06/24 05:53 PM
Joined: Nov 2021
Posts: 104
Simo Offline OP
Vogon poet
OP Offline
Vogon poet
Joined: Nov 2021
Posts: 104
greetingz folks ,

im struggling with this alias to get rid of a bad nick using regex but for some reason it still gets the kick reason as a nick as well


its for multiple nicks like : /bnickmodule Adey Alithia Dawkins France Frey Gispert Hoehne Krantz Lili lkinc Marala Tombaugh .some custom kickmessage

for some reason it gets after the . and sets ban as well

while i thought the line: var %user = $gettok($gettok($1-,1,46),%i,32) took care of that

testing with echo of line: var %user = $gettok($gettok($1-,1,46),%i,32) only gets nicks before the .

but for some reason it gets the spaces as well and sets as a ban.




Code
bnickmodule {
  var %chan = $active |  if (%chan !ischan) { echo -stac own  This command can only be used on a channel. | halt }
  if (!$1) { echo -a *********** no valid entry was given ************* Syntax : /nban SomeBadNickHere | halt }  
  if (!$nick(%chan,$me,@%) && o !isin $usermode) { halt }  
  var %i = 1 | tokenize 32 $replace($1-,$chr(44),$chr(32)) | while ($gettok($1-,%i,32)) {
    var %user =  $gettok($gettok($1-,1,46),%i,32) 
    if (. isin $1-) { var %kickmsg =  $gettok($1-,-1,46) - «-Inappropriate-NICK-» } | else { var %kickmsg «-Inappropriate-NICK-» } 
    if (!$nick(%chan, %user ,@%) && !$istok( $me , %user ,32)  && %user ison %chan) { var %kick = $addtok(%kick,%user,44) , %nm = $addtok(%nm,$nickbanregex( %user ),32) }
    if (%user !ison %chan) { var %nm = $addtok(%nm,$nickbanregex( %user ),32)  }    
    if ($numtok(%kick,44) == 4) { kick  %chan  %kick  %kickmsg  | unset %kick }
    if ($numtok(%nm,32) == 6) { mode %chan + $+ $str(b,$numtok(%nm,32)) %nm | unset %nm }
    inc %i
  }
  if (%kick) { kick  %chan  %kick  %kickmsg  }
  if (%nm) { mode  %chan + $+ $str(b,$numtok(%nm,32)) %nm }
}




nickbanregex {
  var %badnickregex $regsubex($remdupl($1),/([aieuo|0-9|\{\}\[\]\|\\\\`\-\_\`\^]+)/gi,$null)  
  var %badnickregexONE $regsubex($remdupl($1),/([0-9|\{\}\[\]\|\\\\`\-\_\`\^]+)/gi,$null)  
  if ($len(%badnickregex) < 5) {  return $regsubex($remdupl(%badnickregexONE),//g,*) $+ !*@*  }  
  else { return $regsubex(%badnickregex,//g,*) $+ !*@*  }
}

 

Last edited by Simo; 10/06/24 07:39 PM.
Simo #272696 15/06/24 04:25 PM
Joined: Nov 2021
Posts: 104
Simo Offline OP
Vogon poet
OP Offline
Vogon poet
Joined: Nov 2021
Posts: 104
It works fine if no custom kick message is used but when it's used it sees the kick message as bad nicks to ban too.

Simo #272704 18/06/24 08:52 PM
Joined: Nov 2021
Posts: 104
Simo Offline OP
Vogon poet
OP Offline
Vogon poet
Joined: Nov 2021
Posts: 104
ok i found a solution and it seems to work as expected.


Link Copied to Clipboard