egghelp.org community Forum Index
[ egghelp.org home | forum home ]
egghelp.org community
Discussion of eggdrop bots, shell accounts and tcl scripts.
 
 FAQFAQ   SearchSearch   MemberlistMemberlist   UsergroupsUsergroups   RegisterRegister 
 ProfileProfile   Log in to check your private messagesLog in to check your private messages   Log inLog in 

caps kicker

 
Post new topic   Reply to topic    egghelp.org community Forum Index -> Script Requests
View previous topic :: View next topic  
Author Message
WisH-GR
Voice


Joined: 17 Aug 2009
Posts: 9

PostPosted: Sun Sep 13, 2009 11:46 am    Post subject: caps kicker Reply with quote

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
Back to top
View user's profile Send private message
arfer
Master


Joined: 26 Nov 2004
Posts: 436
Location: Manchester, UK

PostPosted: Sun Sep 13, 2009 5:28 pm    Post subject: Reply with quote

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:

# 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
Back to top
View user's profile Send private message
WisH-GR
Voice


Joined: 17 Aug 2009
Posts: 9

PostPosted: Sun Sep 13, 2009 5:51 pm    Post subject: Reply with quote

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
Back to top
View user's profile Send private message
arfer
Master


Joined: 26 Nov 2004
Posts: 436
Location: Manchester, UK

PostPosted: Sun Sep 13, 2009 6:06 pm    Post subject: Reply with quote

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
Back to top
View user's profile Send private message
WisH-GR
Voice


Joined: 17 Aug 2009
Posts: 9

PostPosted: Sun Sep 13, 2009 7:46 pm    Post subject: Reply with quote

thank you very much arfer.
much appreciated
Back to top
View user's profile Send private message
devilsoulblack
Halfop


Joined: 19 Nov 2003
Posts: 62
Location: Chile

PostPosted: Sat Sep 18, 2010 8:26 pm    Post subject: Reply with quote

@arfer : thanks for sharing
_________________
---------
Add [SOLVED] to the thread title if your issue has been.
Search - FAQ
Back to top
View user's profile Send private message Send e-mail Visit poster's website Yahoo Messenger MSN Messenger
Display posts from previous:   
Post new topic   Reply to topic    egghelp.org community Forum Index -> Script Requests All times are GMT - 4 Hours
Page 1 of 1

 
Jump to:  
You cannot post new topics in this forum
You cannot reply to topics in this forum
You cannot edit your posts in this forum
You cannot delete your posts in this forum
You cannot vote in polls in this forum


Forum hosting provided by Reverse.net

Powered by phpBB © 2001, 2005 phpBB Group
subGreen style by ktauber