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 

help please anti caps for arfer

 
Post new topic   Reply to topic    egghelp.org community Forum Index -> Scripting Help
View previous topic :: View next topic  
Author Message
Sedition
Voice


Joined: 14 Dec 2011
Posts: 16
Location: Bolivia, Beni, Trinidad / DALnet

PostPosted: Sat Feb 13, 2016 10:28 pm    Post subject: help please anti caps for arfer Reply with quote

# web http://forum.egghelp.org/viewtopic.php?t=17178
## updates anti caps for arfer my bros Wink ##
## random phrases was added to the kick method.
## It was added that recognize nicknames and channels random phrases (%chan %nick)
## my email urquizoandrade@hotmail.com /server irc.dal.net #tcls and #lapaz

set nocapsauth "arfer"
set nocapsversion "v1.0.5"

# set bot user flags to ignore text
set vCapsFlagsAllow fo

# set text length (excluding spaces) to allow without checking
set vCapsLengthAllow 3

# 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 2

# set here the mode of punishment - metodo de kick
# 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 4

# if punishment mode 2, set here the time in minutes the ban lasts
set vCapsBanTime 10

### random phrases ##

set nocapspb {
"%nick Please lower your capital letters, uppercase means shouting in %c."
"Please Disables capitalization Thanks, %nick it's like you scream in %c."
"Do not use capitalization, %nick it's like you shout in %c, Please avoid using them."
}

proc ctcp_capslock {nick uhost hand chan keyword arg} {
pCapsDetect $nick $uhost $hand $chan $arg
}

bind PUBM - * pCapsDetect
bind ctcp - ACTION ctcp_capslock

proc pCapsDetect {nick uhost hand chan text} {
global vCapsBanTime vCapsFlagsAllow vCapsLengthAllow vCapsPercentAllow nocapspb
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 $uhost
timer $vCapsBanTime [list pushmode $chan -b $uhost]
}
default {return 0}
}
putkick $chan $nick "no caps please autoban for $vCapsBanTime min. excess caps, in ($vCapsPercentAllow%)"
putserv "MODE $chan +b $uhost" -next
timer $vCapsBanTime [list pushmode $chan -b $uhost]
} else {
set drem [lindex $nocapspb [rand [llength $nocapspb]]]
set output "*** 12[llength $vCapsSinBin(${nick},$chan)] 4Notice *** 14ò.Ó 14$drem"
regsub -all -- {%c} $output $chan output
putserv "PRIVMSG $chan :[regsub -all -- {%nick} $output $nick]"
}
}
}
}
}
return 0
}

putlog "anticaps $nocapsversion by $nocapsauth has been loaded successfully"
_________________
good I wait for all that he learns more on tcl thanks for shaping a solid group of help
Back to top
View user's profile Send private message Send e-mail MSN Messenger
Display posts from previous:   
Post new topic   Reply to topic    egghelp.org community Forum Index -> Scripting Help 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