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 in caps kicker tcl for arfer
Goto page Previous  1, 2
 
Post new topic   Reply to topic    egghelp.org community Forum Index -> Script Requests
View previous topic :: View next topic  
Author Message
caesar
Mint Rubber


Joined: 14 Oct 2001
Posts: 3741
Location: Mint Factory

PostPosted: Sun Nov 08, 2020 4:57 am    Post subject: Reply with quote

In:
Code:

if {![matchattr [nick2hand $nick] $vCapsFlagsAllow $chan]} {

you don't need nick2hand $nick since you already have the hand (user account) from the proc itself.
_________________
Once the game is over, the king and the pawn go back in the same box.
Back to top
View user's profile Send private message
Arnold_X-P
Master


Joined: 30 Oct 2006
Posts: 221
Location: DALnet - Trinidad - Beni - Bolivia

PostPosted: Sun Nov 08, 2020 8:39 pm    Post subject: Reply with quote

would this be correct?
Code:

if {[matchattr $hand $vCapsFlagsAllow $chan] || [isop $nick $chan] || [ishalfop $nick $chan]} {

_________________
Very Happy thanks to that they help, that others learn Very Happy
Back to top
View user's profile Send private message Send e-mail Visit poster's website MSN Messenger
caesar
Mint Rubber


Joined: 14 Oct 2001
Posts: 3741
Location: Mint Factory

PostPosted: Mon Nov 09, 2020 1:49 am    Post subject: Reply with quote

Sure, that's what I said. Smile
_________________
Once the game is over, the king and the pawn go back in the same box.
Back to top
View user's profile Send private message
Arnold_X-P
Master


Joined: 30 Oct 2006
Posts: 221
Location: DALnet - Trinidad - Beni - Bolivia

PostPosted: Sun Dec 06, 2020 12:26 am    Post subject: Reply with quote

if i delete these two routes
Code:
if {[botisop $chan]} {
 if {![matchattr [nick2hand $nick] $vCapsFlagsAllow $chan]} {


and I replace them with
Code:
if {[matchattr $hand $vCapsFlagsAllow $chan] || [isop $nick $chan] || [ishalfop $nick $chan]} {


I get the error again

Quote:
[04:02:41] Tcl error [pCapsDetect]: can't read "diff": no such variable

Code:

# caps.tcl

# set bot user flags to ignore text
set vCapsFlagsAllow fo

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

# set maximum percentage caps allowed (calculation excludes spaces in text)
# greater than 0, less than or equal to 100
set vCapsPercentAllow 40

# 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

# Set this to 1 to ignore nicks in lines
set vIgnoreNick 1

bind PUBM - * pCapsDetect

proc pCapsDetect {nick uhost hand chan text} {
    global vCapsBanTime vCapsFlagsAllow vCapsLengthAllow vCapsPercentAllow
    global vCapsPunishMode vCapsSinBin vCapsSinTime vCapsWarnings
 if {[matchattr $hand $vCapsFlagsAllow $chan] || [isop $nick $chan] || [ishalfop $nick $chan]} {
         if {$::vIgnoreNick == 1} {
            set nicks [chanlist $chan]
            set text [join [ldiff [split $text] $nicks]]
         }
            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
}


proc ldiff {list1 list2 {option -exact}} {
   if {$option ne "-nocase"} { set option -exact }
   return [lmap x $list1 {expr {[lsearch $option $list2 $x] < 0 ? $x : [continue]}}]
}

proc lintersect {list1 list2 {option -exact}} {
   if {$option ne "-nocase"} { set option -exact }
   return [lmap x $list1 {expr {[lsearch $option $list2 $x] >= 0 ? $x : [continue]}}]
}

putlog "Caps.tcl by arfer is loaded"

 

_________________
Very Happy thanks to that they help, that others learn Very Happy
Back to top
View user's profile Send private message Send e-mail Visit poster's website MSN Messenger
SpiKe^^
Owner


Joined: 12 May 2006
Posts: 792
Location: Tennessee, USA

PostPosted: Sun Dec 06, 2020 11:02 am    Post subject: Reply with quote

The variable "diff" is neither set nor called in the code you posted above.
_________________
SpiKe^^

Get BogusTrivia 2.06.4.7 at www.mytclscripts.com
or visit the New Tcl Acrhive at www.tclarchive.org
.
Back to top
View user's profile Send private message Visit poster's website
Arnold_X-P
Master


Joined: 30 Oct 2006
Posts: 221
Location: DALnet - Trinidad - Beni - Bolivia

PostPosted: Sun Dec 06, 2020 6:06 pm    Post subject: Reply with quote

thanks SpiKe^^ and caesar
_________________
Very Happy thanks to that they help, that others learn Very Happy
Back to top
View user's profile Send private message Send e-mail Visit poster's website MSN Messenger
Arnold_X-P
Master


Joined: 30 Oct 2006
Posts: 221
Location: DALnet - Trinidad - Beni - Bolivia

PostPosted: Sun Jan 10, 2021 8:10 pm    Post subject: Reply with quote

it can be omitted in uppercase nicknames, for example the use of [] or: is omitted;
example if there is an uppercase nickname called GENICOZZ
And the users name it in the channel like this GENICOZZ: or also GENICOZZ;
and the bot omit that semicolons and also omit when it is put between characters like [the-nickname]
example [GENICOZZ]
it is possible to create that variant so that it skips ; : and also [ ]
_________________
Very Happy thanks to that they help, that others learn Very Happy
Back to top
View user's profile Send private message Send e-mail Visit poster's website MSN Messenger
Arnold_X-P
Master


Joined: 30 Oct 2006
Posts: 221
Location: DALnet - Trinidad - Beni - Bolivia

PostPosted: Sun Jan 10, 2021 9:24 pm    Post subject: Reply with quote

add this path but it doesn't work for me to skip : ; [ ]
Code:

regsub -- {-[0-9A-Z].} $text {:;[ ]} text

_________________
Very Happy thanks to that they help, that others learn Very Happy
Back to top
View user's profile Send private message Send e-mail Visit poster's website 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
Goto page Previous  1, 2
Page 2 of 2

 
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