hello i would like to request a help with a script.
I need a script that detectes a text in caps percentage more than 90% and after 3 warns it kicks.but the difficult part i think is what limitations i need.
1)i have many ops with nicks with CAPS(for example a nick can be like this: GEORGE) so i want it to detect if the text is on the nicklist
2)i want also to be able to except +f or +o users.
thank you in advance.i have recieved help whenever i needed so i am sure someone can help
Not sure what you mean by caps in the nick or in the nicklist. The following script checks for caps in the channel text. It does not react to caps in a nick. Is this what you require?
# caps.tcl
# set bot user flags to ignore text
set vCapsFlagsAllow fo
# set text length (excluding spaces) to allow without checking
set vCapsLengthAllow 8
# set maximum percentage caps allowed (calculation excludes spaces in text)
# greater than 0, less than or equal to 100
set vCapsPercentAllow 90
# set number of warnings before punishing
# integer value equal to or greater than 1
set vCapsWarnings 3
# set here the mode of punishment
# 1 == kick only (after warnings)
# 2 == kickban (after warnings)
set vCapsPunishMode 1
# time in minutes within which a warning remains valid
# even after the user is punished, passed offences remain valid for this time period
# hence a user could be punished twice for two consecutive offences
set vCapsSinTime 20
# if punishment mode 2, set here the time in minutes the ban lasts
set vCapsBanTime 10
bind PUBM - * pCapsDetect
proc pCapsDetect {nick uhost hand chan text} {
global vCapsBanTime vCapsFlagsAllow vCapsLengthAllow vCapsPercentAllow
global vCapsPunishMode vCapsSinBin vCapsSinTime vCapsWarnings
if {[botisop $chan]} {
if {![matchattr [nick2hand $nick] $vCapsFlagsAllow $chan]} {
set caps [regexp -all -- {[A-Z]} $text]
set total [string length [regsub -all -- {[\s]} $text {}]]
if {$total > $vCapsLengthAllow} {
set percent [expr {$caps * 100.0 / $total}]
if {$percent > $vCapsPercentAllow} {
set now [unixtime]
set max [expr {$now - ($vCapsSinTime * 60)}]
lappend vCapsSinBin(${nick},$chan) $now
foreach sin $vCapsSinBin(${nick},$chan) {
if {$sin >= $max} {lappend newlist $sin}
}
set vCapsSinBin(${nick},$chan) $newlist
if {[llength $vCapsSinBin(${nick},$chan)] > $vCapsWarnings} {
switch -- $vCapsPunishMode {
1 {}
2 {
pushmode $chan +b ${nick}!$uhost
flushmode $chan
timer $vCapsBanTime [list pushmode $chan -b ${nick}!$uhost]
}
default {return 0}
}
putkick $chan $nick "excess caps, you were warned"
} else {
set output "*** [llength $vCapsSinBin(${nick},$chan)] WARNING(S) *** within the last $vCapsSinTime minutes for excess caps"
putserv "PRIVMSG $chan :$nick $output"
}
}
}
}
}
return 0
}
# eof
i want it to check for example this text
<@GiOrGoS[A]> ERRIKOS
ERRIKOS is the nick of an oper i have,i want it to ignore if the text is a single word and is a nickname in the nicklist currently
As it stands, the script will work fine without modification because you can set the length of text to ignore. As it is currently configured it will completely ignore any text (including nicks) that is less than or equal to 8 characters (excluding spaces).