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.
Old posts that have not been replied to for several years.
Papillon
Owner
Posts: 724 Joined: Fri Feb 15, 2002 8:00 pm
Location: *.no
Post
by Papillon » Wed Jul 09, 2003 2:57 am
Code: Select all
regexp {^(\w){3}(\d){2}\w(\d){3}$} $nick
dunno if it's the best one but it should work
Elen sila lúmenn' omentielvo
Sir_Fz
Revered One
Posts: 3794 Joined: Sun Apr 27, 2003 3:10 pm
Location: Lebanon
Contact:
Post
by Sir_Fz » Wed Jul 09, 2003 6:00 am
may I ask what does a regexp do ?
ppslim
Revered One
Posts: 3914 Joined: Sun Sep 23, 2001 8:00 pm
Location: Liverpool, England
Post
by ppslim » Wed Jul 09, 2003 6:22 am
Regexp is a complex matching system.
Where normal string based matches (glob style) you can detect for certain characters. It doesn't allow for exraction, only the evidance of existance.
Regexp allow to to prove they are there, extract, and can even do this matching, based on if certain part exist or not.
The quickest example I can give of this, is the stripping code used by No!Spam.
Colour codes are made up of a control character, the forground colour, a background colour and comma.
Not all of these elements are required to produce a colour, and text may or may not contain them at all.
A regular expression can and does remove the colour code, even if certain parts of it are missing.
Sir_Fz
Revered One
Posts: 3794 Joined: Sun Apr 27, 2003 3:10 pm
Location: Lebanon
Contact:
Post
by Sir_Fz » Wed Jul 09, 2003 7:45 am
oh ok, well the no!spam strip code:
Code: Select all
set text [ctrl:filter $text]
proc ctrl:filter {str} {
regsub -all -- {\003[0-9]{0,2}(,[0-9]{0,2})?|\017|\037|\002|\026|\006|\007} $str "" str
return $str
}
so the regexp u posted above should be like
set nick [comp:nick $nick]
and then add a proc like:
proc comp:nick {com} {
regexp {^(\w){3}(\d){2}\w(\d){3}$} $nick
}
or how ?
Papillon
Owner
Posts: 724 Joined: Fri Feb 15, 2002 8:00 pm
Location: *.no
Post
by Papillon » Wed Jul 09, 2003 8:13 am
the regexp I gave will just return 1 on match, or 0 if not.. so you could use it like this
Code: Select all
if {[regexp {^(\w){3}(\d){2}\w(\d){3}$} $nick]} {
blablabla ban or whatever
}
Elen sila lúmenn' omentielvo
Sir_Fz
Revered One
Posts: 3794 Joined: Sun Apr 27, 2003 3:10 pm
Location: Lebanon
Contact:
Post
by Sir_Fz » Wed Jul 09, 2003 1:43 pm
ok, i understoud.
thanx
Dedan
Master
Posts: 260 Joined: Wed Jul 09, 2003 10:50 pm
Location: Memphis
Post
by Dedan » Thu Jul 10, 2003 8:53 am
hi,
i get flooded with bots that use those types of nicks too.
how can i use that regep code?
I once was an intelligent young man, now i am old and i can not remember who i was.
Sir_Fz
Revered One
Posts: 3794 Joined: Sun Apr 27, 2003 3:10 pm
Location: Lebanon
Contact:
Post
by Sir_Fz » Thu Jul 10, 2003 10:08 am
well creat a bind for join.
example: bind join - * proc-name
then from tcl-commands.doc in your eggdrop's /doc directory.
creat the proc for the join bind and add the like given by Papillon:
if {[regexp {^(\w){3}(\d){2}\w(\d){3}$} $nick]} {
blablabla ban or whatever
}
Dedan
Master
Posts: 260 Joined: Wed Jul 09, 2003 10:50 pm
Location: Memphis
Post
by Dedan » Sat Jul 12, 2003 10:21 am
would this kick the 3rd bot nick, or am i missing something?
Code: Select all
# Channels you want to Check for Bot Nicks on.
# Multiple channels seperated by spaces.
set my.chans "#TCLhelp #TCLlovers"
# Set the Max Number of Bot Nicks Allowed before a kick
set bot.limit 3
# During the Number of Seconds
set bot.sec 7
bind join - * bot:check
proc bot:check {nick uhost handle chan} {
global botnick my.chans bot.limit bot.sec bot.ctr
set chan [string tolower $chan]
if {![botisop $chan]} {
return
}
if {![info exists bot.ctr($chan)]} {
return 0
}
if {[regexp {^(\w){3}(\d){2}\w(\d){3}$} $nick]} {
incr bot.ctr($chan) 1
utimer $bot.sec [list bot:dec $chan]
if {$bot.ctr($chan) >= $bot.limit} {
ban:bots $nick $chan $type
} else {
return 0
}
}
}
proc bot:dec {chan} {
global bot.ctr
incr bot.ctr($chan) -1
}
foreach chan [strlwr $my.chans] {
if {![info exists bot.ctr([strlwr $chan])]} {
set bot.ctr([strlwr $chan]) 0
}
}
I once was an intelligent young man, now i am old and i can not remember who i was.
Sir_Fz
Revered One
Posts: 3794 Joined: Sun Apr 27, 2003 3:10 pm
Location: Lebanon
Contact:
Post
by Sir_Fz » Sat Jul 12, 2003 11:10 am
wouldn't this be a more simple script ?
Code: Select all
##channels u want the script to apply on
set my.chans "#TCLhelp #TCLlovers"
##set ban reason
set brsn "your reason here"
###code###
bind join - * check:nick
proc check:nick {nick uhost hand chan} {
foreach chan [split $::my.chans] {
if {[regexp {^(\w){3}(\d){2}\w(\d){3}$} $nick] && [botisop $chan]} {
set mask "*!*@[lindex [split $uhost @] 1]"
putquick "KICK $chan $nick :$::brsn"
putquick "MODE $chan +b $mask"
}
}
}
also yes, I think your script should work fine.