| View previous topic :: View next topic |
| Author |
Message |
caesar Mint Rubber

Joined: 14 Oct 2001 Posts: 3741 Location: Mint Factory
|
Posted: Sun Nov 08, 2020 4:57 am Post subject: |
|
|
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 |
|
 |
Arnold_X-P Master

Joined: 30 Oct 2006 Posts: 221 Location: DALnet - Trinidad - Beni - Bolivia
|
Posted: Sun Nov 08, 2020 8:39 pm Post subject: |
|
|
would this be correct?
| Code: |
if {[matchattr $hand $vCapsFlagsAllow $chan] || [isop $nick $chan] || [ishalfop $nick $chan]} {
|
_________________
thanks to that they help, that others learn  |
|
| Back to top |
|
 |
caesar Mint Rubber

Joined: 14 Oct 2001 Posts: 3741 Location: Mint Factory
|
Posted: Mon Nov 09, 2020 1:49 am Post subject: |
|
|
Sure, that's what I said.  _________________ Once the game is over, the king and the pawn go back in the same box. |
|
| Back to top |
|
 |
Arnold_X-P Master

Joined: 30 Oct 2006 Posts: 221 Location: DALnet - Trinidad - Beni - Bolivia
|
Posted: Sun Dec 06, 2020 12:26 am Post subject: |
|
|
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"
|
_________________
thanks to that they help, that others learn  |
|
| Back to top |
|
 |
SpiKe^^ Owner

Joined: 12 May 2006 Posts: 792 Location: Tennessee, USA
|
Posted: Sun Dec 06, 2020 11:02 am Post subject: |
|
|
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 |
|
 |
Arnold_X-P Master

Joined: 30 Oct 2006 Posts: 221 Location: DALnet - Trinidad - Beni - Bolivia
|
Posted: Sun Dec 06, 2020 6:06 pm Post subject: |
|
|
thanks SpiKe^^ and caesar _________________
thanks to that they help, that others learn  |
|
| Back to top |
|
 |
Arnold_X-P Master

Joined: 30 Oct 2006 Posts: 221 Location: DALnet - Trinidad - Beni - Bolivia
|
Posted: Sun Jan 10, 2021 8:10 pm Post subject: |
|
|
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 [ ] _________________
thanks to that they help, that others learn  |
|
| Back to top |
|
 |
Arnold_X-P Master

Joined: 30 Oct 2006 Posts: 221 Location: DALnet - Trinidad - Beni - Bolivia
|
Posted: Sun Jan 10, 2021 9:24 pm Post subject: |
|
|
add this path but it doesn't work for me to skip : ; [ ]
| Code: |
regsub -- {-[0-9A-Z].} $text {:;[ ]} text |
_________________
thanks to that they help, that others learn  |
|
| Back to top |
|
 |
|