egghelp.org community Forum Index
[ egghelp.org home | forum home ]
egghelp.org community
Discussion of eggdrop bots, shell accounts and tcl scripts.
 
 FAQFAQ   SearchSearch   MemberlistMemberlist   UsergroupsUsergroups   RegisterRegister 
 ProfileProfile   Log in to check your private messagesLog in to check your private messages   Log inLog in 

detect Nick with length longer than 20 char in it

 
Post new topic   Reply to topic    egghelp.org community Forum Index -> Script Requests
View previous topic :: View next topic  
Author Message
simo
Owner


Joined: 22 Mar 2015
Posts: 941

PostPosted: Sat Dec 31, 2016 10:04 am    Post subject: detect Nick with length longer than 20 char in it Reply with quote

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
View user's profile Send private message
SpiKe^^
Owner


Joined: 12 May 2006
Posts: 792
Location: Tennessee, USA

PostPosted: Sat Dec 31, 2016 4:08 pm    Post subject: Reply with quote

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
View user's profile Send private message Visit poster's website
simo
Owner


Joined: 22 Mar 2015
Posts: 941

PostPosted: Sun Jan 01, 2017 3:27 pm    Post subject: Reply with quote

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
View user's profile Send private message
SpiKe^^
Owner


Joined: 12 May 2006
Posts: 792
Location: Tennessee, USA

PostPosted: Sun Jan 01, 2017 6:22 pm    Post subject: Reply with quote

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
View user's profile Send private message Visit poster's website
simo
Owner


Joined: 22 Mar 2015
Posts: 941

PostPosted: Sun Jan 01, 2017 7:45 pm    Post subject: Reply with quote

great works fine thx Spike^^

add the kickreason var tho
Back to top
View user's profile Send private message
SpiKe^^
Owner


Joined: 12 May 2006
Posts: 792
Location: Tennessee, USA

PostPosted: Mon Jan 02, 2017 7:34 pm    Post subject: Bad-Nick script. Reply with quote

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
View user's profile Send private message Visit poster's website
simo
Owner


Joined: 22 Mar 2015
Posts: 941

PostPosted: Mon Jan 02, 2017 8:46 pm    Post subject: Reply with quote

loaded and tested it works really wel Spike^^ thanx again
Back to top
View user's profile Send private message
Display posts from previous:   
Post new topic   Reply to topic    egghelp.org community Forum Index -> Script Requests All times are GMT - 4 Hours
Page 1 of 1

 
Jump to:  
You cannot post new topics in this forum
You cannot reply to topics in this forum
You cannot edit your posts in this forum
You cannot delete your posts in this forum
You cannot vote in polls in this forum


Forum hosting provided by Reverse.net

Powered by phpBB © 2001, 2005 phpBB Group
subGreen style by ktauber