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.

detect Nick with length longer than 20 char in it

Requests for complete scripts or modifications/fixes for scripts you didn't write. Response not guaranteed, and no thread bumping!
Post Reply
s
simo
Revered One
Posts: 1070
Joined: Sun Mar 22, 2015 2:41 pm

detect Nick with length longer than 20 char in it

Post by simo »

greetz how can this code be modify to detect nicks on join and nickchange longer than 20

Code: Select all

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.
User avatar
SpiKe^^
Owner
Posts: 831
Joined: Fri May 12, 2006 10:20 pm
Location: Tennessee, USA
Contact:

Post by SpiKe^^ »

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
.
s
simo
Revered One
Posts: 1070
Joined: Sun Mar 22, 2015 2:41 pm

Post by simo »

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.
User avatar
SpiKe^^
Owner
Posts: 831
Joined: Fri May 12, 2006 10:20 pm
Location: Tennessee, USA
Contact:

Post by SpiKe^^ »

Added new unrelated function to an existing "bad-words in nick" script.

Script can now kick/ban for nicks being too long¿...

Code: Select all

# 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
.
s
simo
Revered One
Posts: 1070
Joined: Sun Mar 22, 2015 2:41 pm

Post by simo »

great works fine thx Spike^^

add the kickreason var tho
User avatar
SpiKe^^
Owner
Posts: 831
Joined: Fri May 12, 2006 10:20 pm
Location: Tennessee, USA
Contact:

Bad-Nick script.

Post by SpiKe^^ »

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: Select all

# 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
.
s
simo
Revered One
Posts: 1070
Joined: Sun Mar 22, 2015 2:41 pm

Post by simo »

loaded and tested it works really wel Spike^^ thanx again
Post Reply