mIRC Home    About    Download    Register    News    Help

Print Thread
Page 1 of 2 1 2
#273252 03/03/25 01:17 PM
Joined: May 2022
Posts: 121
F
Fernet Offline OP
Vogon poet
OP Offline
Vogon poet
F
Joined: May 2022
Posts: 121
I wish to have an addon that on join, check the user nick.
I already have the one that invite to change nick in case of BADNICK (using BADWORD)
Now I wish this addon also to check if:
- Nick letters are less than 3
- Nick letters are more than 30% upper case.

Code
ON @*:JOIN:#channel: { if (LETTERS < 3) && ([UPPER LETTERS > 30%) badnick_alias $unsafe($chan $nick) }
ON *:NICK: { if (LETTERS < 3) && (UPPER LETTERS > 30%) && ($me isop #channel) && ($newnick ison #channel)) badnick_alias $unsafe(#channel $newnick) }

alias badnick_alias {
  var %chan $1 , %nick $2
  if ((MindUser* !iswm %nick) || (%nick !ison %chan)) return
  if (!$3) {
    .notice %nick Please change your nick within 2 minutes, or you will be kicked.
    .timer 1  30 badnick_alias $unsafe($1-2  30)
    .timer 1  90 badnick_alias $unsafe($1-2  90)
    .timer 1 120 badnick_alias $unsafe($1-2 120)
    return
  }
  elseif ($3 == 30) /notice %nick This is your second warning change your nick or be kicked 1 minute remaining!!
  elseif ($3 == 90) /notice %nick This is your LAST warning change your nick or be kicked 30 seconds remaining!!
  elseif ($3 == 120) kick %chan %nick Please change your nick

Any help please? Thanks

Last edited by Fernet; 03/03/25 02:48 PM.
Fernet #273253 03/03/25 03:11 PM
Joined: Jul 2006
Posts: 4,020
W
Hoopy frood
Offline
Hoopy frood
W
Joined: Jul 2006
Posts: 4,020
If you want to use && on the two conditions length of nick < 3 and % of uppercase in nick > 30% that makes no sense as you're really checking at best nickname of 2 character, aka either 100% or 50% which is then equivalent to checking if there's any uppercase at all. $unsafe should only be used on command which double evaluate, aka the typical /timer or /scid or /scon otherwise you'll be passing incorrect value to the alias. I'll use || which makes more sense for the condition.

Code
on *:nick:if (($len($nick) < 3) || ($calc($regex($nick,/[A-Z]/g) * 100 / $len($nick)) > 30)) && ($me isop #Alessandra) && ($newnick ison #Alessandra) badnick_alias #alessandra $newnick
For on join it is not so easy because when you join a channel, mIRC does not know the users on the channel yet. For that you must use raw 353

Code
on *:join:#:set %checknick $+ $chan 1
raw 353:*:{
  if ($($+(%,checknick,$3),2)) { 
    var %chan $3
    tokenize 32 $regsubex($regsubex($4-,^:,),/(?:[ $+ $prefix $+ ]*)([^ !]+)\S+/g,\1 $+ $chr(32))
    echo -ag $1-
    scon -r if ($len( $* ) < 3) || ($calc($regex( $* ,/[A-Z]/g) * 100 / $!len( $* )) > 30) badnick_alias $unsafe(%chan) $*
  }
}
raw 366:*:if ($($+(%,checknick,$2),2)) unset %checknick $+ $2
You may restrict this to your channel only by setting %checknick $+ $chan only if you join your specific channel.


#mircscripting @ irc.swiftirc.net == the best mIRC help channel
Wims #273254 03/03/25 05:05 PM
Joined: May 2022
Posts: 121
F
Fernet Offline OP
Vogon poet
OP Offline
Vogon poet
F
Joined: May 2022
Posts: 121
Is it right?

Code
on *:join:#channel:set %checknick $+ $chan 1
raw 353:*:{
  if ($($+(%,checknick,$3),2)) { 
    var %chan $3
    tokenize 32 $regsubex($regsubex($4-,^:,),/(?:[ $+ $prefix $+ ]*)([^ !]+)\S+/g,\1 $+ $chr(32))
    echo -ag $1-
    scon -r if ($len( $* ) < 3) || ($calc($regex( $* ,/[A-Z]/g) * 100 / $!len( $* )) > 30) badnick_alias $unsafe(%chan) $*
  }
}
raw 366:*:if ($($+(%,checknick,$2),2)) unset %checknick $+ $2

alias badnick_alias {
  var %chan $1 , %nick $2
  if ((MindUser* !iswm %nick) || (%nick !ison %chan)) return
  if (!$3) {
    .notice %nick Please change your nick within 2 minutes, or you will be kicked.
    .timer 1  30 badnick_alias $unsafe($1-2  30)
    .timer 1  90 badnick_alias $unsafe($1-2  90)
    .timer 1 120 badnick_alias $unsafe($1-2 120)
    return
  }
  elseif ($3 == 30) /notice %nick This is your second warning change your nick or be kicked 1 minute remaining!!
  elseif ($3 == 90) /notice %nick This is your LAST warning change your nick or be kicked 30 seconds remaining!!
  elseif ($3 == 120) kick %chan %nick Please change your nick
}

Fernet #273256 04/03/25 12:10 AM
Joined: Nov 2021
Posts: 154
Vogon poet
Offline
Vogon poet
Joined: Nov 2021
Posts: 154
you could try this

Code


ON *:nick:{
  haltdef
  var %whloop = 1
  while ( $comchan($newnick,%whloop) != $null )  {
    var %chan $v1
    if ($istok(Dalnet undernet,$network,32) && $istok(#chan,%chan,32)) {
      if ($nick(%chan,$newnick,@&~%) || !$nick(%chan,$me,@&~%)) { halt } 
      badnick_alias %chan $newnick 
    }
    inc %whloop
  }
  halt
}



on !*:JOIN:#:{
  if ($istok(Dalnet undernet,$network,32) && $istok(#chan,$chan,32)) {
    if (!$Timer($+(CheckNicks,.,$network,.,$chan,.,$nick))) {  .Timer $+ $+(CheckNicks,.,$network,.,$chan,.,$nick)  -md 1 750 badnick_alias $unsafe($chan) $nick  } 
  }
}

alias badnick_alias {
  var %chan $1 , %nick $2
   if (MindUser* !iswm %nick || %nick !ison %chan || $nick( %chan , %nick ,@&~%)) { halt }
   if ($len( %nick ) > 3 || ($calc($regex(%nick,/[A-Z]/g) * 100 / $len(%nick)) > 30)) { kick %chan %nick please change your nick thanks you.... }  
}





Simo #273260 04/03/25 02:28 PM
Joined: May 2022
Posts: 121
F
Fernet Offline OP
Vogon poet
OP Offline
Vogon poet
F
Joined: May 2022
Posts: 121
Thanks sir. Then can I add warning?

Code
 if (!$3) {
    .notice %nick Please change your nick within 2 minutes, or you will be kicked.
    .timer 1  30 badnick_alias $unsafe($1-2  30)
    .timer 1  90 badnick_alias $unsafe($1-2  90)
    .timer 1 120 badnick_alias $unsafe($1-2 120)
    return
  }
  elseif ($3 == 30) /notice %nick This is your second warning change your nick or be kicked 1 minute remaining!!
  elseif ($3 == 90) /notice %nick This is your LAST warning change your nick or be kicked 30 seconds remaining!!
  elseif ($3 == 120) kick %chan %nick Please change your nick
}

Fernet #273262 04/03/25 05:26 PM
Joined: Jul 2006
Posts: 4,020
W
Hoopy frood
Offline
Hoopy frood
W
Joined: Jul 2006
Posts: 4,020
Yes, there's a small error with the on join event (my mistake), it must only trigger when you join the channel, not for others:

on me:*:join:#channel:set %checknick $+ $chan 1


#mircscripting @ irc.swiftirc.net == the best mIRC help channel
Wims #273263 04/03/25 06:11 PM
Joined: May 2022
Posts: 121
F
Fernet Offline OP
Vogon poet
OP Offline
Vogon poet
F
Joined: May 2022
Posts: 121
Originally Posted by Wims
Yes, there's a small error with the on join event (my mistake), it must only trigger when you join the channel, not for others:

on me:*:join:#channel:set %checknick $+ $chan 1

Doesn't work on join. On an user nick change, it works, warn included. On nick jooin, it doesn't work

Simo #273264 04/03/25 06:33 PM
Joined: May 2022
Posts: 121
F
Fernet Offline OP
Vogon poet
OP Offline
Vogon poet
F
Joined: May 2022
Posts: 121
Originally Posted by Simo
you could try this

Code



    if ($istok(Dalnet undernet,$network,32) && $istok(#chan,%chan,32)) 


  if ($istok(Dalnet undernet,$network,32) && $istok(#chan,$chan,32)) {





I'm on another net. This doesn't work for me. I dunno if is just a matter of net...

Fernet #273265 04/03/25 08:31 PM
Joined: Nov 2021
Posts: 154
Vogon poet
Offline
Vogon poet
Joined: Nov 2021
Posts: 154
i guess you could add your network in it.

Fernet #273266 04/03/25 09:49 PM
Joined: Jul 2006
Posts: 4,020
W
Hoopy frood
Offline
Hoopy frood
W
Joined: Jul 2006
Posts: 4,020
I misunderstood, you may keep the current code for when YOU (the bot) rejoin the channel to do a one time scan on all nick.
You then need to add an on join event which trigger for others only which would be a copy of the on nick event:

Code
on @:join:#alessandra:if (($len($nick) < 3) || ($calc($regex($nick,/[A-Z]/g) * 100 / $len($nick)) > 30)) badnick_alias #alessandra $nick
The @ event prefix should ensure that the event only triggers for others (you are not op when you join)


#mircscripting @ irc.swiftirc.net == the best mIRC help channel
Wims #273269 05/03/25 05:35 PM
Joined: May 2022
Posts: 121
F
Fernet Offline OP
Vogon poet
OP Offline
Vogon poet
F
Joined: May 2022
Posts: 121
Originally Posted by Wims
I misunderstood, you may keep the current code for when YOU (the bot) rejoin the channel to do a one time scan on all nick.
You then need to add an on join event which trigger for others only which would be a copy of the on nick event:

Code
on @:join:#alessandra:if (($len($nick) < 3) || ($calc($regex($nick,/[A-Z]/g) * 100 / $len($nick)) > 30)) badnick_alias #alessandra $nick
The @ event prefix should ensure that the event only triggers for others (you are not op when you join)

No need brackets?

Code
on @:join:#alessandra: {
if (($len($nick) < 3) || ($calc($regex($nick,/[A-Z]/g) * 100 / $len($nick)) > 30)) badnick_alias #alessandra $nick
}

Simo #273270 05/03/25 05:37 PM
Joined: May 2022
Posts: 121
F
Fernet Offline OP
Vogon poet
OP Offline
Vogon poet
F
Joined: May 2022
Posts: 121
Originally Posted by Simo
i guess you could add your network in it.

I'll try again again sir. Thanks in advance for help of course

Fernet #273271 05/03/25 06:07 PM
Joined: Jul 2006
Posts: 4,020
W
Hoopy frood
Offline
Hoopy frood
W
Joined: Jul 2006
Posts: 4,020
No, brackets can be omitted when the commands associated to the alias/event are on a single line separated by |, and for conditional statement when there's only a single command associated to that condition.
Though, one may note that mIRC has issues parsing certain keywords (reserved words for statement such as "if" or "while", these statement cannot be overrided with aliases) when they are chained together without bracket, it's pretty rare to be in such situation even for bracketless lovers like me but for example "//if (a) while (1) echo -ag test" will not result in an infinite loop, which it should.

edit: I forgot the * access level after the @ event prefix.

Last edited by Wims; 05/03/25 10:01 PM.

#mircscripting @ irc.swiftirc.net == the best mIRC help channel
Wims #273272 06/03/25 12:36 PM
Joined: May 2022
Posts: 121
F
Fernet Offline OP
Vogon poet
OP Offline
Vogon poet
F
Joined: May 2022
Posts: 121
Originally Posted by Wims
No, brackets can be omitted when the commands associated to the alias/event are on a single line separated by |, and for conditional statement when there's only a single command associated to that condition.
Though, one may note that mIRC has issues parsing certain keywords (reserved words for statement such as "if" or "while", these statement cannot be overrided with aliases) when they are chained together without bracket, it's pretty rare to be in such situation even for bracketless lovers like me but for example "//if (a) while (1) echo -ag test" will not result in an infinite loop, which it should.

edit: I forgot the * access level after the @ event prefix.

What do You think with this:

Code
on @*:join:#channel:if (($len($nick) < 3) || ($calc($regex($nick,/[A-Z]/g) * 100 / $len($nick)) > 30)) badnick_alias #channel $nick

on *:nick:if (($len($nick) < 3) || ($calc($regex($nick,/[A-Z]/g) * 100 / $len($nick)) > 30)) && ($me isop #channel) && ($newnick ison #channel) badnick_alias #channel $newnick

alias badnick_alias {
  var %chan $1 , %nick $2
  if ((MindUser* !iswm %nick) || (%nick !ison %chan)) return
  if (!$3) {
    .notice %nick WARN
    .timer 1  30 badnick_alias $unsafe($1-2  30)
    .timer 1  45 badnick_alias $unsafe($1-2  45)
    .timer 1 60 badnick_alias $unsafe($1-2 60)
    return
  }
  elseif ($3 == 30) /notice %nick SECOND WARN
  elseif ($3 == 45) /notice %nick LAST WARN
  elseif ($3 == 60) kick %chan %nick KICK
}

Simo #273274 07/03/25 02:16 PM
Joined: May 2022
Posts: 121
F
Fernet Offline OP
Vogon poet
OP Offline
Vogon poet
F
Joined: May 2022
Posts: 121
Originally Posted by Simo
you could try this

Code


ON *:nick:{
  haltdef
  var %whloop = 1
  while ( $comchan($newnick,%whloop) != $null )  {
    var %chan $v1
    if ($istok(Dalnet undernet,$network,32) && $istok(#chan,%chan,32)) {
      if ($nick(%chan,$newnick,@&~%) || !$nick(%chan,$me,@&~%)) { halt } 
      badnick_alias %chan $newnick 
    }
    inc %whloop
  }
  halt
}



on !*:JOIN:#:{
  if ($istok(Dalnet undernet,$network,32) && $istok(#chan,$chan,32)) {
    if (!$Timer($+(CheckNicks,.,$network,.,$chan,.,$nick))) {  .Timer $+ $+(CheckNicks,.,$network,.,$chan,.,$nick)  -md 1 750 badnick_alias $unsafe($chan) $nick  } 
  }
}

alias badnick_alias {
  var %chan $1 , %nick $2
   if (MindUser* !iswm %nick || %nick !ison %chan || $nick( %chan , %nick ,@&~%)) { halt }
   if ($len( %nick ) > 3 || ($calc($regex(%nick,/[A-Z]/g) * 100 / $len(%nick)) > 30)) { kick %chan %nick please change your nick thanks you.... }  
}





Doesn't work.
Non error in status.

Wims #273275 07/03/25 02:26 PM
Joined: May 2022
Posts: 121
F
Fernet Offline OP
Vogon poet
OP Offline
Vogon poet
F
Joined: May 2022
Posts: 121
Originally Posted by Wims
If you want to use && on the two conditions length of nick < 3 and % of uppercase in nick > 30% that makes no sense as you're really checking at best nickname of 2 character, aka either 100% or 50% which is then equivalent to checking if there's any uppercase at all. $unsafe should only be used on command which double evaluate, aka the typical /timer or /scid or /scon otherwise you'll be passing incorrect value to the alias. I'll use || which makes more sense for the condition.

Code
on *:nick:if (($len($nick) < 3) || ($calc($regex($nick,/[A-Z]/g) * 100 / $len($nick)) > 30)) && ($me isop #Alessandra) && ($newnick ison #Alessandra) badnick_alias #alessandra $newnick
For on join it is not so easy because when you join a channel, mIRC does not know the users on the channel yet. For that you must use raw 353

Code
on *:join:#:set %checknick $+ $chan 1
raw 353:*:{
  if ($($+(%,checknick,$3),2)) { 
    var %chan $3
    tokenize 32 $regsubex($regsubex($4-,^:,),/(?:[ $+ $prefix $+ ]*)([^ !]+)\S+/g,\1 $+ $chr(32))
    echo -ag $1-
    scon -r if ($len( $* ) < 3) || ($calc($regex( $* ,/[A-Z]/g) * 100 / $!len( $* )) > 30) badnick_alias $unsafe(%chan) $*
  }
}
raw 366:*:if ($($+(%,checknick,$2),2)) unset %checknick $+ $2
You may restrict this to your channel only by setting %checknick $+ $chan only if you join your specific channel.

Doesn't work

Fernet #273276 07/03/25 06:57 PM
Joined: Jul 2006
Posts: 4,020
W
Hoopy frood
Offline
Hoopy frood
W
Joined: Jul 2006
Posts: 4,020
I tested this code with the non event prefixed on join and the raw events with both a nickname of 2 characters and a nickname with more than 30% of uppercase and it triggered a badnick_alias alias I had created to test the code. Feel free to join the channel in my signature if you want further help as there could be any kind of reason as to why it's not working for you, and figuring it out on a forum is more complicated than on IRC.


#mircscripting @ irc.swiftirc.net == the best mIRC help channel
Wims #273280 09/03/25 05:14 PM
Joined: May 2022
Posts: 121
F
Fernet Offline OP
Vogon poet
OP Offline
Vogon poet
F
Joined: May 2022
Posts: 121
Originally Posted by Wims
I tested this code with the non event prefixed on join and the raw events with both a nickname of 2 characters and a nickname with more than 30% of uppercase and it triggered a badnick_alias alias I had created to test the code. Feel free to join the channel in my signature if you want further help as there could be any kind of reason as to why it's not working for you, and figuring it out on a forum is more complicated than on IRC.

I decided to split the addon. So maybe I'll make 2 differents (one for upper and one for letters).
This is the one if letters < 3:

Code
on *:JOIN:#channel:{
  if (($len($nick) < 3) { /badnick_alias $chan $nick }
}

on *:nick:if (($len($nick) < 3)) badnick_alias #channel $nick

alias badnick_alias {
  var %chan $1 , %nick $2
  if (%nick !ison %chan) return
  if (!$3) {
    notice %nick FIRST WARN
    .timer 1 30 badnick_alias %chan %nick 30
    .timer 1 45 badnick_alias %chan %nick 45
    .timer 1 60 badnick_alias %chan %nick 60
    return
  }
  elseif ($3 == 30) notice %nick SECOND WARN
  elseif ($3 == 45) notice %nick LAST WARN
  elseif ($3 == 60) kick %chan %nick KICK

}

And doesn't work.
I forgot to tell: mIRC is 7.78 and no other addons loaded (so no conflict)

Fernet #273281 10/03/25 02:00 PM
Joined: May 2022
Posts: 121
F
Fernet Offline OP
Vogon poet
OP Offline
Vogon poet
F
Joined: May 2022
Posts: 121
Originally Posted by Fernet
Originally Posted by Wims
I tested this code........

I decided to split the addon. So maybe I'll make 2 differents (one for upper and one for letters).
This is the one if letters < 3:

Code
...........

on *:nick:if (($len($nick) < 3)) badnick_alias #channel $nick

............

And doesn't work.
I forgot to tell: mIRC is 7.78 and no other addons loaded (so no conflict)

I solved with:
Code
on *:nick:if (($len($newnick) < 3)) badnick_alias #`Chandra_Area51 $newnick

Fernet #273282 10/03/25 04:55 PM
Joined: Nov 2021
Posts: 154
Vogon poet
Offline
Vogon poet
Joined: Nov 2021
Posts: 154
ive tested this and it all works for me

Note: ive used a stacked nicks in the on op event if your networks allows stacked kicks and modes kick #channel nick,nick,nick,nick,nick,nick
not sure on what network you are gonna use this as some networks allow stacked kicks.

Code


ON *:nick:{
  haltdef
  var %whloop = 1
  while ( $comchan($newnick,%whloop) != $null )  {
    var %chan $v1
    if (!$nick(%chan,$newnick,@&~%) && $nick(%chan,$me,@&~%)) { badnick_alias %chan $newnick  }
    inc %whloop
  }
  halt
}


ON *:op:#:{
  if ($opnick == $me) {
    var %loop = 1, %nick , %kickmsg = please change your nick thanks you.... 
    while (%loop <= $nick($chan,0)) {
      %nick = $nick($chan,%loop)
      if ($len( %nick ) < 3 || ($calc($regex(%nick,/[A-Z]/g) * 100 / $len(%nick)) > 30)) { 
        if (!$nick( %chan , %nick ,~&@%)) { var %kick = $addtok(%kick,%nick,44) }
        if ($numtok(%kick,44) == 4) { kick $chan %kick %kickmsg | unset %kick }      
      }  
      inc %loop 1
    }
  }
  if (%kick) { kick $chan %kick %kickmsg }
}


on !*:JOIN:#test:{
  if (!$Timer($+(CheckNicks,.,$network,.,$chan,.,$nick))) {   .Timer $+ $+(CheckNicks,.,$network,.,$chan,.,$nick)  -md 1 750 badnick_alias $unsafe($chan) $nick  } 
}

alias badnick_alias {
  var %chan $1 , %nick $2
  if (%nick !ison %chan || $nick( %chan , %nick ,@&~%)) { halt }
  if ($len( %nick ) < 3 || ($calc($regex(%nick,/[A-Z]/g) * 100 / $len(%nick)) > 30)) { kick %chan %nick please change your nick thanks you.... }  
}



Simo #273283 11/03/25 03:08 PM
Joined: May 2022
Posts: 121
F
Fernet Offline OP
Vogon poet
OP Offline
Vogon poet
F
Joined: May 2022
Posts: 121
Originally Posted by Simo
ive tested this and it all works for me

Note: ive used a stacked nicks in the on op event if your networks allows stacked kicks and modes kick #channel nick,nick,nick,nick,nick,nick
not sure on what network you are gonna use this as some networks allow stacked kicks.

Code
..................

alias badnick_alias {
  var %chan $1 , %nick $2
  if (%nick !ison %chan || $nick( %chan , %nick ,@&~%)) { halt }
  if ($len( %nick ) < 3 || ($calc($regex(%nick,/[A-Z]/g) * 100 / $len(%nick)) > 30)) { kick %chan %nick please change your nick thanks you.... }  
}

.....................

I looks really great and (of course) perfectly work.
Can I change badnick_alias with this:

Code

alias badnick_alias {
  var %chan $1 , %nick $2
if (%nick !ison %chan || $nick( %chan , %nick ,@&~%)) { halt }
  if ($len( %nick ) < 3 || ($calc($regex(%nick,/[A-Z]/g) * 100 / $len(%nick)) > 30))  {
    notice %nick FIRST WARN
    .timer 1 30 badnick_alias %chan %nick 30
    .timer 1 45 badnick_alias %chan %nick 45
    .timer 1 60 badnick_alias %chan %nick 60
    return
  }
  elseif ($3 == 30) notice %nick SECOND WARN
  elseif ($3 == 45) notice %nick LAST WARN
  elseif ($3 == 60) kick %chan %nick KICK

}

So to give warning to user and kick after 60 sec?

Fernet #273284 11/03/25 10:37 PM
Joined: Nov 2021
Posts: 154
Vogon poet
Offline
Vogon poet
Joined: Nov 2021
Posts: 154
this seems to work for me :

Code

on !*:JOIN:#:{
  if (!$Timer($+(CheckNicks,.,$network,.,$chan,.,$nick))) {   .Timer $+ $+(CheckNicks,.,$network,.,$chan,.,$nick)  -md 1 750 badnick_alias $unsafe($chan) $nick  } 
}


ON *:nick:{
  haltdef
  var %whloop = 1
  while ( $comchan($newnick,%whloop) != $null )  {
    var %chan $v1
    if (!$nick(%chan,$newnick,@&~%) && $nick(%chan,$me,@&~%)) { badnick_alias %chan $newnick  }
    inc %whloop
  }
  halt
}


ON *:op:#test:{
  if ($opnick == $me) {
    var %loop = 1, %nick , %kickmsg = please change your nick thank you.... 
    while (%loop <= $nick($chan,0)) {
      %nick = $nick($chan,%loop)
      if ($len( %nick ) < 3 || ($calc($regex(%nick,/[A-Z]/g) * 100 / $len(%nick)) > 30)) { 
        if (!$nick($chan,%nick,~&@%+)) { var %kick = $addtok(%kick,%nick,44) }
        if ($numtok(%kick,44) == 4) { kick $chan %kick %kickmsg | unset %kick }      
      }  
      inc %loop 1
    }
  }
  if (%kick) { kick $chan %kick %kickmsg }
}




alias badnick_alias {
  var %chan $1 , %nick $2
  if (%nick !ison %chan || $nick( %chan , %nick ,@&~%)) { halt }
  if ($len( %nick ) < 3 || ($calc($regex(%nick,/[A-Z]/g) * 100 / $len(%nick)) > 30))  {
    if (!$Timer($+(CheckNickZ,.,$network,.,%chan,.,%nick))) {   
      NOTICE %nick FIRST WARNING
      .Timer $+ $+(CheckNickZ,.,$network,.,%chan,.,%nick)  3 15 badnick_still_on_chan $unsafe(%chan) %nick  
    } 
  }
}


alias badnick_still_on_chan {
  inc % [ $+ [ $+(CheckWarnings,.,$network,.,$1,.,$2) ] ] 
  if ($2 ison $1 && % [ $+ [ $+(CheckWarnings,.,$network,.,$1,.,$2) ] ] < 3) { NOTICE $2 % [ $+ [ $+(CheckWarnings,.,$network,.,$1,.,$2) ] ] WARNINGS } 
  elseif ( % [ $+ [ $+(CheckWarnings,.,$network,.,$1,.,$2) ] ] == 3 && $2 ison $1 ) { kick $1 $2 % [ $+ [ $+(CheckWarnings,.,$network,.,$1,.,$2) ] ] WARNINGS | .Timer $+ $+(CheckNickZ,.,$network,.,$1,.,$2) off | unset % $+ $+(CheckWarnings,.,$network,.,$1,.,$2)  }
  elseif ($2 !ison $1) {  .Timer $+ $+(CheckNickZ,.,$network,.,$1,.,$2) off | unset % [ $+ [ $+(CheckWarnings,.,$network,.,$1,.,$2) ] ]  }
}





Simo #273287 12/03/25 11:43 AM
Joined: May 2022
Posts: 121
F
Fernet Offline OP
Vogon poet
OP Offline
Vogon poet
F
Joined: May 2022
Posts: 121
I'll test it Simo. Stay tuned wink
And of course thanks so so much for Your help

Simo #273386 29/04/25 02:32 AM
Joined: Jul 2020
Posts: 15
D
Pikka bird
Offline
Pikka bird
D
Joined: Jul 2020
Posts: 15
Can you help me with this remote?
It works very well. The problem is this: even if the user changes their nickname, it still kicks them out of the channel. I see the error is in the time sequence. I would appreciate your help, please.
Code
 on +4!:join:#: {  
  if ( $nick != $me ) && ( $me isop $chan ) && ( $nick !isop $chan ) { 
msg $chan 4First Notice59 $nick your 4Nick It is inappropriate. Change It Within 12 Seconds in Command /3Nick New-Nick. } { .timerscriptname $+ $nick 1 12 msg $chan 4Second Notice59 $nick Change your nickname by typing /nick new-nick 4(1Last notice4) } { .timerscriptname0K $+ $nick 1 20 /ban -ku1800 $chan $nick 9 14your 3Nick is 3Incompatible with the theme of 3Channel, please3 change your nickname So 7/nick new-nick and come back. autoban of 30min. } }

on +4!:NICK:{
  if $level($newnick) != 4 ) { .timerscriptname $+ $nick off | ./timerscriptname0K $+ $nick off }
}

druino #273390 01/05/25 06:43 AM
Joined: May 2022
Posts: 121
F
Fernet Offline OP
Vogon poet
OP Offline
Vogon poet
F
Joined: May 2022
Posts: 121
Originally Posted by druino
Can you help me with this remote?
It works very well. The problem is this: even if the user changes their nickname, it still kicks them out of the channel. I see the error is in the time sequence. I would appreciate your help, please.
Code
 on +4!:join:#: {  
  if ( $nick != $me ) && ( $me isop $chan ) && ( $nick !isop $chan ) { 
msg $chan 4First Notice59 $nick your 4Nick It is inappropriate. Change It Within 12 Seconds in Command /3Nick New-Nick. } { .timerscriptname $+ $nick 1 12 msg $chan 4Second Notice59 $nick Change your nickname by typing /nick new-nick 4(1Last notice4) } { .timerscriptname0K $+ $nick 1 20 /ban -ku1800 $chan $nick 9 14your 3Nick is 3Incompatible with the theme of 3Channel, please3 change your nickname So 7/nick new-nick and come back. autoban of 30min. } }

on +4!:NICK:{
  if $level($newnick) != 4 ) { .timerscriptname $+ $nick off | ./timerscriptname0K $+ $nick off }
}

I didn't understood the rules about compatible/incompatible? nicks. When a nick is incompatible?

Last edited by Fernet; 01/05/25 11:39 AM.
Fernet #273392 02/05/25 06:15 PM
Joined: Jul 2020
Posts: 15
D
Pikka bird
Offline
Pikka bird
D
Joined: Jul 2020
Posts: 15
that no matter how much you change your bad nickname, you will still be expelled.
Code
 on +4!:join:#: {  
  if ( $nick != $me ) && ( $me isop $chan ) && ( $nick !isop $chan ) { 
msg $chan 4First Notice59 $nick your 4Nick It is inappropriate. Change It Within 12 Seconds in Command /3Nick New-Nick. } { .timerscriptname $+ $nick 1 12 msg $chan 4Second Notice59 $nick Change your nickname by typing /nick new-nick 4(1Last notice4) } { .timerscriptname0K $+ $nick 1 20 /ban -ku1800 $chan $nick 9 14your 3Nick is 3Incompatible with the theme of 3Channel, please3 change your nickname So 7/nick new-nick and come back. autoban of 30min. } }

on +4!:NICK:{
  if $level($newnick) != 4 ) { .timerscriptname $+ $nick off | ./timerscriptname0K $+ $nick off }
}
[/quote]

Simo #273417 10/05/25 12:06 PM
Joined: May 2022
Posts: 121
F
Fernet Offline OP
Vogon poet
OP Offline
Vogon poet
F
Joined: May 2022
Posts: 121
Originally Posted by Simo
this seems to work for me :

Code
on !*:JOIN:#:{
  if (!$Timer($+(CheckNicks,.,$network,.,$chan,.,$nick))) {   .Timer $+ $+(CheckNicks,.,$network,.,$chan,.,$nick)  -md 1 750 badnick_alias $unsafe($chan) $nick  } 
}

ON *:nick:{
  haltdef
  var %whloop = 1
  while ( $comchan($newnick,%whloop) != $null )  {
    var %chan $v1
    if (!$nick(%chan,$newnick,@&~%) && $nick(%chan,$me,@&~%)) { badnick_alias %chan $newnick  }
    inc %whloop
  }
  halt
}

ON *:op:#test:{
  if ($opnick == $me) {
    var %loop = 1, %nick , %kickmsg = please change your nick thank you.... 
    while (%loop <= $nick($chan,0)) {
      %nick = $nick($chan,%loop)
      if ($len( %nick ) < 3 || ($calc($regex(%nick,/[A-Z]/g) * 100 / $len(%nick)) > 30)) { 
        if (!$nick($chan,%nick,~&@%+)) { var %kick = $addtok(%kick,%nick,44) }
        if ($numtok(%kick,44) == 4) { kick $chan %kick %kickmsg | unset %kick }      
      }  
      inc %loop 1
    }
  }
  if (%kick) { kick $chan %kick %kickmsg }
}

alias badnick_alias {
  var %chan $1 , %nick $2
  if (%nick !ison %chan || $nick( %chan , %nick ,@&~%)) { halt }
  if ($len( %nick ) < 3 || ($calc($regex(%nick,/[A-Z]/g) * 100 / $len(%nick)) > 30))  {
    if (!$Timer($+(CheckNickZ,.,$network,.,%chan,.,%nick))) {   
      NOTICE %nick FIRST WARNING
      .Timer $+ $+(CheckNickZ,.,$network,.,%chan,.,%nick)  3 15 badnick_still_on_chan $unsafe(%chan) %nick  
    } 
  }
}

alias badnick_still_on_chan {
  inc % [ $+ [ $+(CheckWarnings,.,$network,.,$1,.,$2) ] ] 
  if ($2 ison $1 && % [ $+ [ $+(CheckWarnings,.,$network,.,$1,.,$2) ] ] < 3) { NOTICE $2 % [ $+ [ $+(CheckWarnings,.,$network,.,$1,.,$2) ] ] WARNINGS } 
  elseif ( % [ $+ [ $+(CheckWarnings,.,$network,.,$1,.,$2) ] ] == 3 && $2 ison $1 ) { kick $1 $2 % [ $+ [ $+(CheckWarnings,.,$network,.,$1,.,$2) ] ] WARNINGS | .Timer $+ $+(CheckNickZ,.,$network,.,$1,.,$2) off | unset % $+ $+(CheckWarnings,.,$network,.,$1,.,$2)  }
  elseif ($2 !ison $1) {  .Timer $+ $+(CheckNickZ,.,$network,.,$1,.,$2) off | unset % [ $+ [ $+(CheckWarnings,.,$network,.,$1,.,$2) ] ]  }
}


I tested this code SImo. And as always is ALMOST perfetc, thanks in advance. Just 2 things (if possible):

- I don't need to write 1 WARNINGS :number 1 is not necessary. Only text WARNING is enough or at least something like 2°WARNING
- I need it to set a banquiet on join/nickchange (if the nick is irregular). Something like:

Code
  if ($len( %nick ) < 3 || ($calc($regex(%nick,/[A-Z]/g) * 100 / $len(%nick)) > 30))  {
 /mode %chan +b ~q: $+ $address($2,2)
}

Thanks

Fernet #273418 10/05/25 05:55 PM
Joined: Nov 2021
Posts: 154
Vogon poet
Offline
Vogon poet
Joined: Nov 2021
Posts: 154
try this :

Code


on !*:JOIN:#:{
  if (!$Timer($+(CheckNicks,.,$network,.,$chan,.,$nick))) {   .Timer $+ $+(CheckNicks,.,$network,.,$chan,.,$nick)  -md 1 750 badnick_alias $unsafe($chan) $nick  } 
}

ON *:nick:{
  haltdef
  var %whloop = 1
  while ( $comchan($newnick,%whloop) != $null )  {
    var %chan $v1
    if (!$nick(%chan,$newnick,@&~%) && $nick(%chan,$me,@&~%)) { badnick_alias %chan $newnick  }
    inc %whloop
  }
  halt
}

ON *:op:#test:{
  if ($opnick == $me) {
    var %loop = 1, %nick , %kickmsg = please change your nick thank you.... 
    while (%loop <= $nick($chan,0)) {
      %nick = $nick($chan,%loop)
      if ($len( %nick ) < 3 || ($calc($regex(%nick,/[A-Z]/g) * 100 / $len(%nick)) > 30)) { 
        if (!$nick($chan,%nick,~&@%+)) { var %banmask = $addtok(%banmask,$MuteBanMask(%nick),32) }
        if ($numtok(%banmask,32) == 10) { mode %chan + $+ $str(b,$numtok(%banmask,32)) %banmask  | unset %banmask }      
      }  
      inc %loop 1
    }
  }
  if (%banmask) { mode %chan + $+ $str(b,$numtok(%banmask,32)) %banmask }
}


Alias MuteBanMask { return q: $+ $address($1,2) }


alias badnick_alias {
  var %chan $1 , %nick $2
  if (%nick !ison %chan || $nick( %chan , %nick ,@&~%)) { halt }
  if ($len( %nick ) < 3 || ($calc($regex(%nick,/[A-Z]/g) * 100 / $len(%nick)) > 30))  {
    if (!$Timer($+(CheckNickZ,.,$network,.,%chan,.,%nick))) {   
      .Timer $+ $+(CheckNickZ,.,$network,.,%chan,.,%nick)  3 15 badnick_still_on_chan $unsafe(%chan) %nick  
    } 
  }
}

alias badnick_still_on_chan {
  inc $+(%,CheckWarnings,.,$network,.,$1,.,$2)
  if ($2 ison $1 && $($+(%,CheckWarnings,.,$network,.,$1,.,$2),2) < 3) { NOTICE $2  WARNING } 
  elseif ($($+(%,CheckWarnings,.,$network,.,$1,.,$2),2)  == 3 && $2 ison $1 ) { if ($+(q:$address($2,2)) !isban $1) { mode $1 +b $+(q:$address($2,2)) } | .Timer $+ $+(CheckNickZ,.,$network,.,$1,.,$2) off | unset % $+ $+(CheckWarnings,.,$network,.,$1,.,$2)  }
  elseif ($2 !ison $1) {  .Timer $+ $+(CheckNickZ,.,$network,.,$1,.,$2) off | unset $eval($+(%,CheckWarnings,.,$network,.,$1,.,$2),1)  }
}





Simo #273420 11/05/25 10:55 AM
Joined: May 2022
Posts: 121
F
Fernet Offline OP
Vogon poet
OP Offline
Vogon poet
F
Joined: May 2022
Posts: 121
Last edit doesn't work. No quiet and no ban after warn. Your previos version was perfect about ban after warn.

What do You think with (about banquiet):
Code
Alias MuteBanMask { return /mode #MYCHANNEL +b ~q: $+ $address($2,2) }

Still working on ban after warn...

Last edited by Fernet; 11/05/25 11:40 AM.
Fernet #273421 11/05/25 11:37 AM
Joined: Nov 2021
Posts: 154
Vogon poet
Offline
Vogon poet
Joined: Nov 2021
Posts: 154
Code

on !*:JOIN:#:{
  if (!$Timer($+(CheckNicks,.,$network,.,$chan,.,$nick))) {   .Timer $+ $+(CheckNicks,.,$network,.,$chan,.,$nick)  -md 1 750 badnick_alias $unsafe($chan) $nick  } 
}

ON *:nick:{
  haltdef
  var %whloop = 1
  while ( $comchan($newnick,%whloop) != $null )  {
    var %chan $v1
    if (!$nick(%chan,$newnick,@&~%) && $nick(%chan,$me,@&~%)) { badnick_alias %chan $newnick  }
    inc %whloop
  }
  halt
}

ON *:op:#:{
  if ($opnick == $me) {
    var %loop = 1, %nick , %kickmsg = please change your nick thank you.... 
    while (%loop <= $nick($chan,0)) {
      %nick = $nick($chan,%loop)
      if ($len( %nick ) < 3 || ($calc($regex(%nick,/[A-Z]/g) * 100 / $len(%nick)) > 30)) { 
        if (!$nick($chan,%nick,~&@%+)) { var %banmask = $addtok(%banmask,$MuteBanMask(%nick),32) }
        if ($numtok(%banmask,32) == 10) { mode $chan + $+ $str(b,$numtok(%banmask,32)) %banmask  | unset %banmask }      
      }  
      inc %loop 1
    }
  }
  if (%banmask) { mode %chan + $+ $str(b,$numtok(%banmask,32)) %banmask }
}


Alias MuteBanMask { return ~q: $+ $address($1,2) }


alias badnick_alias {
  var %chan $1 , %nick $2
  if (%nick !ison %chan || $nick( %chan , %nick ,@&~%)) { halt }
  if ($len( %nick ) < 3 || ($calc($regex(%nick,/[A-Z]/g) * 100 / $len(%nick)) > 30))  {
    if (!$Timer($+(CheckNickZ,.,$network,.,%chan,.,%nick))) {   
      .Timer $+ $+(CheckNickZ,.,$network,.,%chan,.,%nick)  3 15 badnick_still_on_chan $unsafe(%chan) %nick  
    } 
  }
}

alias badnick_still_on_chan {
  inc $+(%,CheckWarnings,.,$network,.,$1,.,$2)
  if ($2 ison $1 && $($+(%,CheckWarnings,.,$network,.,$1,.,$2),2) < 3) { NOTICE $2  WARNING } 
  elseif ($($+(%,CheckWarnings,.,$network,.,$1,.,$2),2)  == 3 && $2 ison $1 ) { if ($MuteBanMask($2) !isban $1) { mode $1 +b $MuteBanMask($2) } | .Timer $+ $+(CheckNickZ,.,$network,.,$1,.,$2) off | unset % $+ $+(CheckWarnings,.,$network,.,$1,.,$2)  }
  elseif ($2 !ison $1) {  .Timer $+ $+(CheckNickZ,.,$network,.,$1,.,$2) off | unset $eval($+(%,CheckWarnings,.,$network,.,$1,.,$2),1)  }
}


Page 1 of 2 1 2

Link Copied to Clipboard