alias sticky {
var %re = /(.)\1{4,}/
return $iif($regex($1-,%re), $regml(1), $null)
}
on *:Text:*:#:{
if ($nick !isop #) { return }
; Looping through the words in the line to find sticky letters...
var %x = 1
while ($gettok($1-, %x, 32) != $null) {
var %word = $v1
; Checking if there's sticky letters in the word..
if ($sticky(%word) != $null) {
if !$istok(%spam.warned,$nick,32) {
; warning user
msg $chan $nick -> stop spamming! [warning]
; add user to %spam.warned, so we can check it later
set -e %spam.warned $addtok(%spam.warned,$nick,32)
; set timer to remove user from %spam.warned after 300s
.timer 1 300 remove.warned $nick
}
else {
msg $chan $nick -> you had been warned! [Timedout for 120 sec.]
msg $chan .timeout $nick 120
}
}
inc %x
if ( $calc($regex($1-,/[A-Z]/g) / $regex($1-,/[A-Z]/gi) * 100) >= 70 ) {
; check if user is not warned yet
if !$istok(%caps.warned,$nick,32) {
; warning user
msg $chan $nick -> stop typing in caps! [warning]
; add user to %caps.warned, so we can check it later
set -e %caps.warned $addtok(%caps.warned,$nick,32)
; set timer to remove user from %caps.warned after 300s
.timer 1 300 remove.warned $nick
}
else {
msg $chan $nick -> you had been warned! [Timedout for 120 sec.]
msg $chan .timeout $nick 120
}
}
}