Kick by Nick length

By Abass on Dec 20, 2011

[11:44:29] asAoCw was kicked by Guest17069 (abbass)
[11:44:31]
asFiSb was kicked by Guest17069 (abbass)
[11:44:31] asJeXe was kicked by Guest17069 (abbass)
[11:44:31]
asJyEs was kicked by Guest17069 (abbass)
[11:44:31] asKmHt was kicked by Guest17069 (abbass)
[11:44:31]
asLkXw was kicked by Guest17069 (abbass)
[11:44:31] asNvSx was kicked by Guest17069 (abbass)
[11:44:31]
asOcBx was kicked by Guest17069 (abbass)
[11:44:31] asPhLa was kicked by Guest17069 (abbass)
[11:44:31]
asQaAo was kicked by Guest17069 (abbass)
[11:44:31] asUuZb was kicked by Guest17069 (abbass)
[11:44:31]
asYiVl was kicked by Guest17069 (abbass)
[11:44:31] * asZnKs was kicked by Guest17069 (abbass)

menu Channel {
  -
  Kick by Nick length:KBL $chan $$len($$?="Enter length") $?="Enter reason"
  -
}

alias KBL {
  if ($1 ischan) && ($me isop $1) && ($2 isnum 1-) {
    var %x = 1
    while ($nick($1,%x,r)) {
      var %nick = $v1
      if ($len(%nick) == $2) {  $iif(%nick ison $1,kick $1 %nick  $iif($3,$3-,Banned),noop) }
      inc %x
    }
  }
}

Comments

Sign in to comment.
_Dean_   -  Dec 23, 2011
 $iif(%nick ison $1,kick $1 %nick  $iif($3,$3-,Banned),noop)

if there is no command for the second condition of $iif dont need to use "noop", just let it empty

 Respond  
MaSOuD   -  Dec 21, 2011

True that :P

 Respond  
Jethro   -  Dec 20, 2011

I don't think this snippet is practical because it checks the preset length to kick a user, not the nickname pattern. Any innocent user that matches the targeted length will be purged.

 Respond  
MaSOuD   -  Dec 20, 2011

pff, I just lol'd when i saw that this guy has posted this snippet here. He came to me last night and asked me to write such a snippet for him. Then he f*cked it and posted it here.
This is the original snippet: http://pastebin.com/GyKcR9Tq

I used "$nick ison $chan" because i had /timer in there, (To not flood the guy off the server) so it might that the person weren't in the channel anymore and it would give error....
I'm not saying that i've written this flawlessly... It might have errors, or not working properly. Honestly, i didn't even test it, i just wrote it quickly to give the guy an idea.

Also, about checking "if ($2 isnum 1-) { ...}", it used to be a /command, that's why i just wanted to make sure that the number is positive (Just like jaytea said.). And after that the guy asked me to add a popup for it either.

Another note: I used "$len($$?="Enter length")" because he said that he want to write ???? (one question mark per character) which is really dumb.. i told him to just write a number but he wanted it like this.. lol

 Respond  
Fuzionx   -  Dec 20, 2011

$2 is the length you typed in, not the nickname length. But I get your point, the check is a bit useless.

 Respond  
Jethro   -  Dec 20, 2011

Ah I see, but how could a nickname length be a negative value?

 Respond  
Fuzionx   -  Dec 20, 2011

"1-" makes sure the length is >0, I guess that's his intention.

 Respond  
Jethro   -  Dec 20, 2011

Yes, my fault. The regex is needless really, which makes it rather inane.

I don't know what you meant by $2 being positive with the isnum operator. It's not checking range but ensuring $2 is a number.

 Respond  
jaytea   -  Dec 20, 2011

For isnum, and I don't know why you put "1-", you could simply use: if ($2 isnum).

maybe because he wants to ensure $2 is positive? i mean, that much is obvious, but i can't see what else there is to be confused about.

also, i don't understand how you could use the phrase 'you could simply' and then include this in the same post

if ($regex(%n,/(.){ $+ $2 $+ }/)) {
 Respond  
Jethro   -  Dec 20, 2011

You don't need to check for ischan because you already indicate that in your menu popup. It has to be activated in channel where the client that runs the code is situated. For isnum, and I don't know why you put "1-", you could simply use: if ($2 isnum). Here is my take on your snippet:

menu channel,nicklist {
  -
  Kick by Nick length:kbl # $$?="Enter length" $$?="Enter reason"
  -
}
alias -l kbl {
  if ($me isop $1) && ($2 isnum) {
    var %x = 1, %n
    while ($nick($1,%x,r)) {
      %n = $v1
      if ($regex(%n,/(.){ $+ $2 $+ }/)) {
        kick $1 %n $iif($3,$3-,Banned)
        inc %x
      }
    }
  }
}
 Respond  
jaytea   -  Dec 20, 2011

there's no need for an ison check since you're only testing the results of $nick(). that is to say, $nick($1, ...) = %nick implies (%nick ison $1).

 Respond  
Fuzionx   -  Dec 20, 2011
$$len($$?="Enter length")

This will cause your script not to work properly. If someone enters "10" it will be: $len(10) = 2. And the double $ have no use either if I'm not mistaken.

if ($len(%nick) == $2) {  $iif(%nick ison $1,kick $1 %nick  $iif($3,$3-,Banned),noop) }

This will kick everyone with the exact length you entered, not the ones who have a nickname longer than it. If you want that, you should use ">=". And you could do the if %nick ison $1 check in the first if statement.

Try this:

if ($len(%nick) == $2) && (%nick ison $1) {
  kick $1 %nick  $iif($3,$3-,Banned)
}

Note: I did not change "==" to ">=" in this code.

 Respond  
Are you sure you want to unfollow this person?
Are you sure you want to delete this?
Click "Unsubscribe" to stop receiving notices pertaining to this post.
Click "Subscribe" to resume notices pertaining to this post.