Pretty simple code. I am currently experimenting the use of regex as I have just started learning. This snippet uses regex to monitor the precentage of capital letters used in bits of text. I hope this works for everyone.
#caps On
on @*:TEXT:*:#:{
var %n 2
if ($nick isreg $chan) {
var %percentage 60
if ($calc($regex($1-,/[A-Z]/g) / $len($1-) * 100) > %percentage) {
if (%n < 3) {
inc $+(%,caps,.,$nick,.,$wildsite)
var %i $($+(%,caps,.,$nick,.,$wildsite),2)
if (%i < %n) {
msg $chan You are currently using too many captial letters. This is the $ord(%i) time that you have broken this rule. Please stop this conduct or immidiate action will be taken against you.
}
if (%i = 3) {
ban -ku120 # $nick You are using $calc($regex($1-,/[A-Z]/g) / $len($1-) * 100) percent caps. You have been warned before, you will now be banned.
unset $+(%caps,.,$nick,.,$wildsite)
}
}
}
}
}
on @*:ACTION:*:#:{
var %n 2
if ($nick isreg $chan) {
var %percentage 60
if ($calc($regex($1-,/[A-Z]/g) / $len($1-) * 100) > %percentage) {
if (%n < 3) {
inc $+(%,caps,.,$nick,.,$wildsite)
var %i $($+(%,caps,.,$nick,.,$wildsite),2)
if (%i < %n) {
msg $chan You are currently using too many captial letters. This is the $ord(%i) time that you have broken this rule. Please stop this conduct or immidiate action will be taken against you.
}
if (%i = 3) {
ban -ku120 # $nick You are using $calc($regex($1-,/[A-Z]/g) / $len($1-) * 100) percent caps. You have been warned before, you will now be banned.
unset $+(%caps,.,$nick,.,$wildsite)
}
}
}
}
}
#caps end
menu channel {
caps kicker $group(#caps).status:
.On/off:$iif($group(#caps).status = off, enable #caps, disable #caps)
}
It is quite easy for someone to use more than 5 capital letters in a message. Perhaps a better method would be to kick people who use a certain percentage of capital letters, for example: OMG JOIN #NEWBP0WNAGE NOW!!! That sentence has 20 out of 28 characters capitalised, which would be about 71% capital letters. The maximum could be set around 50%, or even better, inclue a method for the user to define the percentage.