|
Quia
|
Quia
|
Is there a way to make a ban that would effect only people who have three numbers in their userid? I thought that ? was a number wildcard by the way it was described under $address, but testing proved otherwise.
|
|
|
|
Joined: Dec 2002
Posts: 1,995
Hoopy frood
|
Hoopy frood
Joined: Dec 2002
Posts: 1,995 |
? is a wildcard for any 1 character, not just numbers.
|
|
|
|
Joined: Aug 2004
Posts: 7,168
Hoopy frood
|
Hoopy frood
Joined: Aug 2004
Posts: 7,168 |
Usage: /3ban <channel> <channel> is optional, but if there's no channel provided, via another means, you will be prompted for it. alias 3ban {
set %chan $iif(!$1 && !$chan,$$?="Channel Name",$iif($1,$1,$chan))
var %a = 1
while %a <= $nick(%chan,0) {
var %c = 1, %d = $right($gettok($address($nick(%chan,%a),0),1,64),-2)
while %c <= $len(%d) {
if $mid(%d,%c,3) isnum {
if $me isop %chan {
.ban -k %chan $nick(%chan,%a)
%c = %d
}
}
inc %c
}
inc %a
}
}
|
|
|
|
schaefer31
|
schaefer31
|
You might possibly want to be more specific about the numbers. Are they located at a specific spot of the userid, such as the start or end? That could possibly make detecting it a bit easier. @RusselB there's a small problem using isnum the way you have in your code in that it would see a 2 digit negative number as a "3" digit number when it shouldn't, although I don't know how likely that is to happen. You should probably specify the range to be 100-999. You might also want to make the isop check before the initial loop, as it would be useless to loop through the nicks in a channel where the OP isn't opped. Again, I don't know how likely that is to happen either
|
|
|
|
Quia
|
Quia
|
Guess I should have been a little more specific.  The intent of the ban is to keep out spammers. My channel gets a lot of them, and I'd say about 95% of them have an automatically generated userid that contains a letter and several numbers, at least three but usually more like 4-6. Anyways, I think you answered my question.. There is no handy number-only version of ?.
|
|
|
|
Joined: Oct 2004
Posts: 8,061
Hoopy frood
|
Hoopy frood
Joined: Oct 2004
Posts: 8,061 |
There is no handy number-only version of ?. There's always regex.
|
|
|
|
schaefer31
|
schaefer31
|
I'm a bit confused here. By userid are you referring to the nickname or the ident? Also are the "userids" always just one letter followed by numbers?
In my other post, I forgot to consider that the first number could have been a zero, so the isnum would fail. A simple regex would indeed be better suited.
|
|
|
|
Joined: Aug 2004
Posts: 7,168
Hoopy frood
|
Hoopy frood
Joined: Aug 2004
Posts: 7,168 |
Good point regarding the negative number option (and the same thing would apply to a two digit number with a decimal/period).
The op should be able to make the modifications that you suggested to my code.
|
|
|
|
HuMoR
|
HuMoR
|
# its the wilcard to a number on some servers... Eg: //mode # +b Guest### Banned Users: Guest345 Guest234 But Guest23 not banned Try +b ###@* to ban a user with only 3 numbers on his userid...
Cya!.-
Last edited by HuMoR; 25/03/07 10:32 AM.
|
|
|
|
Joined: Oct 2004
Posts: 8,061
Hoopy frood
|
Hoopy frood
Joined: Oct 2004
Posts: 8,061 |
Using a wildcard that is only valid on certain networks isn't usually a good idea if there is another method that works on all.
|
|
|
|
Joined: Aug 2004
Posts: 7,168
Hoopy frood
|
Hoopy frood
Joined: Aug 2004
Posts: 7,168 |
On most (if not all) networks that I've been on using the # symbol returns the name of the channel. So, if I was in #help, and tried your suggestion, it would return //moce #help +b Guest#help#help#help Since (to my knowledge) the # character can't be used in a nick, that would return an error stating that the nick isn't on the channel.
|
|
|
|
|