This is the new home of the egghelp.org community forum.
All data has been migrated (including user logins/passwords) to a new phpBB version.


For more information, see this announcement post. Click the X in the top right-corner of this box to dismiss this message.

caps kicker

Requests for complete scripts or modifications/fixes for scripts you didn't write. Response not guaranteed, and no thread bumping!
Post Reply
W
WisH-GR
Voice
Posts: 9
Joined: Mon Aug 17, 2009 4:43 am

caps kicker

Post by WisH-GR »

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
User avatar
arfer
Master
Posts: 436
Joined: Fri Nov 26, 2004 8:45 pm
Location: Manchester, UK

Post by arfer »

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?

Code: Select all

# 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 must have had nothing to do
W
WisH-GR
Voice
Posts: 9
Joined: Mon Aug 17, 2009 4:43 am

Post by WisH-GR »

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
User avatar
arfer
Master
Posts: 436
Joined: Fri Nov 26, 2004 8:45 pm
Location: Manchester, UK

Post by arfer »

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).
I must have had nothing to do
W
WisH-GR
Voice
Posts: 9
Joined: Mon Aug 17, 2009 4:43 am

Post by WisH-GR »

thank you very much arfer.
much appreciated
User avatar
devilsoulblack
Halfop
Posts: 62
Joined: Wed Nov 19, 2003 9:18 pm
Location: Chile
Contact:

Post by devilsoulblack »

@arfer : thanks for sharing
---------
Add [SOLVED] to the thread title if your issue has been.
Search - FAQ
Post Reply