Simple Caps Kicker (using regex)

By TokenMaster on Sep 10, 2005



Why putting $removecs, $isupper etc in a caps protection, when in a few lines you can code it with $regex :)



Simple efficient caps protection



You only have to change this line :



if (%percaps >= 60) {



if (%percaps >= 60) will kick a user who has 60% caps in text and more



if ($len($1-) >= 15) && ($nick isreg #) { <-- This will make the caps protection take action if text`s length is more than 15 or 15 letters and nick is a normal user on the channel :)



Thanks xDaeMoN for making the code look simpler and smaller

on @*:text:*:#:{
if ( $len($1-) >= 15 ) && ( $nick isreg # ) {
if ( $calc($regex($1-,/[A-Z]/g) / $regex($1-,/[A-Z]/gi) * 100) >= 60 ) kick # $nick $v1 $+ % Caps
  }
} 

Comments

Sign in to comment.
Eugenio   -  Jul 10, 2008

LMFAO

 Respond  
EL   -  Jul 10, 2008

Ok then lets base that on a few of yur posts then :

http://www.hawkee.com/snippet/4614/ <-- Incomplete code and untested before posting

http://www.hawkee.com/snippet/4526/ <-- * /if: \'iswn\' unknown operator also your event is messed up.Just my opinion of course.`-.-´

 Respond  
ChunkieMonkey   -  Jul 10, 2008

EL I thought I stated that most recent was boredom, a joke o.0 I just learned something in it XD

 Respond  
Eugenio   -  Jul 10, 2008

rofl this was posted nearly 3 years ago ffs

 Respond  
EL   -  Jul 10, 2008

Is there anywhere I can learn regex?

Not to be an asshole here but maybe you shouldget the basics down before you jump into regex.Statement based on your most recent code.`-.-´

 Respond  
guest598594   -  Jul 10, 2008

There\'s a good tutorial here.

 Respond  
ChunkieMonkey   -  Jul 10, 2008

Is there anywhere I can learn regex?

 Respond  
Noutrious   -  Sep 14, 2005

mmm.. Good job..

 Respond  
xDaeMoN   -  Sep 11, 2005

\"($nick isreg)\" won\'t work because it needs a channel. That should be \"($nick isreg #)\"

You can also minimize your code by not using variables like this:

on @:text::#:{
if ( $len($1-) >= 15 ) && ( $nick isreg # ) {
if ( $calc($regex($1-,/[A-Z]/g) / $regex($1-,/[A-Z]/gi) * 100) >= 60 ) kick # $nick $v1 $+ % Caps
}
}

I think checking if the length of the text typed is 100 or more is a bit high, I only put 15.

 Respond  
TokenMaster   -  Sep 11, 2005

\"user wants to \'protect\' and also if the word is under, say 5 characters, not to kick - such as LOL.\"

duh that is easy :)
It does not count numbers too...

 Respond  
ch1zra   -  Sep 10, 2005

yeah, but the core is what matters :)

nice idea man...

 Respond  
PCTech   -  Sep 10, 2005

Nice but 2 things. There should be an option to not kick OPs or whatever level the user wants to \'protect\' and also if the word is under, say 5 characters, not to kick - such as LOL.

 Respond  
Are you sure you want to unfollow this person?
Are you sure you want to delete this?
Click "Unsubscribe" to stop receiving notices pertaining to this post.
Click "Subscribe" to resume notices pertaining to this post.