| View previous topic :: View next topic |
| Author |
Message |
simo Owner
Joined: 22 Mar 2015 Posts: 941
|
Posted: Sat Dec 31, 2016 10:04 am Post subject: detect Nick with length longer than 20 char in it |
|
|
greetz how can this code be modify to detect nicks on join and nickchange longer than 20
| Code: | set bnick {
"HOMO"
"h0mo"
"hom0"
"gay"
"assho"
"pussy"
"[censored]"
"cock"
"dick"
"anus"
"suck"
"[censored]"
"aars"
"tits"
"boob"
"lick"
"sex"
"anal"
}
set bchan ""
bind join - * join:checkbadnick
bind nick - * nick:tvrsh
proc nick:tvrsh {nick uhost hand chan newnick} {
join:checkbadnick $newnick $uhost $hand $chan
}
proc join:checkbadnick {nick uhost hand chan} {
global bnick bchan kickreason temp
if {(([lsearch -exact [string tolower $bchan] [string tolower $chan]] != -1) || ($bchan == ""))} {
set temp 0
foreach i [string tolower $bnick] {
if {[string match *$i* [string tolower $nick]]} {
set badpart $i
set temp 1
}
}
}
if {!$temp} { return } {
putquick "MODE $chan +b *$badpart*!*@*"
putquick "KICK $chan $nick :$kickreason"
}
}
|
Last edited by simo on Sun Jan 01, 2017 9:25 pm; edited 2 times in total |
|
| Back to top |
|
 |
SpiKe^^ Owner

Joined: 12 May 2006 Posts: 792 Location: Tennessee, USA
|
Posted: Sat Dec 31, 2016 4:08 pm Post subject: |
|
|
Script makes no restriction as to nick length.
Your Eggdrop and/or network may:) _________________ SpiKe^^
Get BogusTrivia 2.06.4.7 at www.mytclscripts.com
or visit the New Tcl Acrhive at www.tclarchive.org
. |
|
| Back to top |
|
 |
simo Owner
Joined: 22 Mar 2015 Posts: 941
|
Posted: Sun Jan 01, 2017 3:27 pm Post subject: |
|
|
| Quote: | Script makes no restriction as to nick length.
Your Eggdrop and/or network may:) |
yea perhaps i wasnt clear with the request
the question wasnt if the script restricted anything the request was to modify it to make it detect nicks longer than 20 char in it and than place ban / kick
tnx. |
|
| Back to top |
|
 |
SpiKe^^ Owner

Joined: 12 May 2006 Posts: 792 Location: Tennessee, USA
|
Posted: Sun Jan 01, 2017 6:22 pm Post subject: |
|
|
Added new unrelated function to an existing "bad-words in nick" script.
Script can now kick/ban for nicks being too long¿...
| Code: |
# NEW Nick-Too-Long setting #
# 0 = do not ban nicks as too long #
# 10+ = ban any nick this long or longer #
set blong 0
set bnick {
"bad"
"words"
"one"
"to"
"each"
"line"
}
# set this to "" or "#channel" or "#chan #chan2 #nother"
set bchan ""
## End of Settings ##
bind join - * join:checkbadnick
bind nick - * nick:tvrsh
set bchan [split [string trim [string tolower $bchan]]]
proc nick:tvrsh {nick uhost hand chan newnick} {
join:checkbadnick $newnick $uhost $hand $chan
}
proc join:checkbadnick {nick uhost hand chan} {
global bnick bchan kickreason blong
set bad 0
if {($blong > 9) && ([string length $nick] >= $blong)} { set bad 1
putquick "MODE $chan +b *!*@[lindex [split $uhost @] 1]"
} elseif {([lsearch -exact $bchan [string tolower $chan]] != -1) || ($bchan == "")} {
foreach i [string tolower $bnick] {
if {[string match *$i* [string tolower $nick]]} {
set badpart $i
set bad 2 ; break
}
}
if {$bad == 2} {
putquick "MODE $chan +b *$badpart*!*@*"
}
}
if {$bad > 0} {
putquick "KICK $chan $nick :$kickreason"
}
}
|
_________________ SpiKe^^
Get BogusTrivia 2.06.4.7 at www.mytclscripts.com
or visit the New Tcl Acrhive at www.tclarchive.org
. |
|
| Back to top |
|
 |
simo Owner
Joined: 22 Mar 2015 Posts: 941
|
Posted: Sun Jan 01, 2017 7:45 pm Post subject: |
|
|
great works fine thx Spike^^
add the kickreason var tho |
|
| Back to top |
|
 |
SpiKe^^ Owner

Joined: 12 May 2006 Posts: 792 Location: Tennessee, USA
|
Posted: Mon Jan 02, 2017 7:34 pm Post subject: Bad-Nick script. |
|
|
A more complete example of the bad-nick script.
fixed an issue where nick-length bans were ignoring the bchan setting.
cleaned up a little.
added the reason setting.
both scan modes now set proper nick bans.
| Code: |
# 1) Ban nicks for containing any of these words. #
set bnick {
"bad"
"words"
"one"
"to"
"each"
"line"
}
# 2) Ban nicks for being very long?? #
# 0 = do not ban nicks as too long #
# 10+ = ban any nick this long or longer #
set blong 0
# Set this to "" (= all channels) or "#channel" or "#chan #chan2 #nother"
set bchan ""
# Set the reason for the kick/ban. #
set kickreason "BadNick: Change your nick and re-join."
## End of Settings ##
bind join - * join:checkbadnick
bind nick - * nick:tvrsh
set bchan [split [string trim [string tolower $bchan]]]
proc nick:tvrsh {nick uhost hand chan newnick} {
join:checkbadnick $newnick $uhost $hand $chan
}
proc join:checkbadnick {nick uhost hand chan} {
global bnick bchan kickreason blong
if {($bchan ne "") && ([lsearch -exact $bchan [string tolower $chan]] == -1)} {
return 0
}
set bad 0
if {($blong > 9) && ([string length $nick] >= $blong)} { set bad 1
#putquick "MODE $chan +b *!*@[lindex [split $uhost @] 1]"
putquick "MODE $chan +b $nick!*@*"
} else {
foreach i [string tolower $bnick] {
if {[string match *$i* [string tolower $nick]]} {
putquick "MODE $chan +b *$i*!*@*"
#putquick "MODE $chan +b $nick!*@*"
set bad 2 ; break
}
}
}
if {$bad > 0} {
putquick "KICK $chan $nick :$kickreason"
}
}
|
_________________ SpiKe^^
Get BogusTrivia 2.06.4.7 at www.mytclscripts.com
or visit the New Tcl Acrhive at www.tclarchive.org
. |
|
| Back to top |
|
 |
simo Owner
Joined: 22 Mar 2015 Posts: 941
|
Posted: Mon Jan 02, 2017 8:46 pm Post subject: |
|
|
| loaded and tested it works really wel Spike^^ thanx again |
|
| Back to top |
|
 |
|