This is the new home of the egghelp.org community forum.
All data has been migrated (including user logins/passwords) to a new phpBB version.


For more information, see this announcement post. Click the X in the top right-corner of this box to dismiss this message.

Need help with my nick evaluating script

Old posts that have not been replied to for several years.
Locked
g
gerkes

Need help with my nick evaluating script

Post by gerkes »

I have a simple script to detect and kicks irritating drones that join a channel of mine frequently.

They all have a familiar characteristic of having a alphabet first then the rest numbers kind of nick.

e.g. k123652735 , b261237863, k4398734, x3645763

I made a simple script to check the nick but it seems it doesnt work. Please help me out!

bind join - * chknick

proc chkchk {nick uhost hand chan} {
global botnick
set nickchar 0
#marks nick guilty as a drone unless proven otherwise
set nickdr 1
#evaluating nick
foreach letter [split $nick ""] {
if {(![catch {incr $letter}]) && ($nickchar > 1)} {
incr nickchar
set nickdr 0
#just for debug purposes
putlog "$nick is proven innocent!"
}
}
if {$nickdr == 1} { putquick "KICK $chan $nick :Get out! }
}

It seems even though the $letter is a number, it never does go through the if {![catch {incr $letter}]} condition. And ALL nicks that join are marked a drone. :roll:

What should I do :-?
User avatar
strikelight
Owner
Posts: 708
Joined: Mon Oct 07, 2002 10:39 am
Contact:

Post by strikelight »

would be simpler to just do:

Code: Select all

if {[regexp {^[A-z][0-9]{1,}$} $nick]} {
.... do stuff ...
}
g
gerkes

Post by gerkes »

thanks a lot, i really appreciate it :)
Locked