View previous topic :: View next topic |
Author |
Message |
simo Revered One
Joined: 22 Mar 2015 Posts: 1027
|
Posted: Fri Jun 19, 2020 4:18 pm Post subject: |
|
|
also since this is used:
if {[info exists bflood($chan:$nick)]} {
does that mean if it hits 300 in the first line it wont trigger ?
from the looks of it it wont wich kinda defeats the porpose as well
if i read it correctly it would always need a second line to come in existence and start counting |
|
Back to top |
|
 |
grumpy Voice

Joined: 10 Jan 2014 Posts: 9 Location: Europe/London
|
Posted: Sat Jun 20, 2020 6:17 am Post subject: |
|
|
Your right it dosen't actually seem to do anything if they go over the limit the first time around
Code: | set ::bflood(maxlength) 300
set ::bflood(unsettime) 5
bind pub - * pubm:byteflood
proc pubm:byteflood {nick host hand chan text} {
# ignore if bot not opped, ignore if its a chanop, ignore if the user has +bfmo globally or +fmo for the channel
if {(![botisop $chan]) || ([isop $nick $chan])} {return}
if {([validuser $hand]) && ([matchattr $hand +bfmo|fmo $chan])} {return}
# get the length of the text
set length [llength $text]
# ban mask
set bmask [maskhost "$nick!$host" 2]
# look up if we have them already in the time limit
set nick [string tolower $nick]
set chan [string tolower $chan]
if {[info exists ::bflood($chan:$nick)]} {
# increase the count by current length of text
set ::bflood($chan:$nick) [expr {$::bflood($chan:$nick) + $length}]
# check they haven't gone over the limit
if {($::bflood($chan:$nick) > $::bflood(maxlength))} {
# they have gone over the 'maxlength'
# devoice them if they are +v
if {[isvoice $nick $chan]} {pushmode $chan -v $nick}
# set the ban
putquick "MODE $chan +b $bmask"
# unset from array
unset ::bflood($chan:$nick)
# finished
return
}
# they haven't gone over the limit, lets set a timer
utimer $::bflood(unsettime) [list unset ::bflood($chan:$nick)]
# finished
return
# they are within the time limit
# we start again
} else {
# check we haven't already gone over the maxlength
if {($length => $::bflood(maxlength))} {
# they have gone over the 'maxlength'
# devoice them if they are +v
if {[isvoice $nick $chan]} {pushmode $chan -v $nick}
# set the ban
putquick "MODE $chan +b $bmask"
# end here
return
}
# they are within the limit add to array and unset after ::bflood(unsettime)
set ::bflood($chan:$nick) $length
# set a time limit on them
utimer $::bflood(unsettime) [list unset ::bflood($chan:$nick)]
# finished
return
}
} |
|
|
Back to top |
|
 |
simo Revered One
Joined: 22 Mar 2015 Posts: 1027
|
Posted: Sat Jun 20, 2020 8:20 am Post subject: |
|
|
for this to work at all u need pubm and not pub
i still keep getting errors about errays
Last edited by simo on Sat Jun 20, 2020 8:41 am; edited 1 time in total |
|
Back to top |
|
 |
simo Revered One
Joined: 22 Mar 2015 Posts: 1027
|
Posted: Sat Jun 20, 2020 8:27 am Post subject: |
|
|
this is what i tried so far:
Code: |
set ::bflood(maxlength) 300
set ::bflood(unsettime) 5
bind pubm - * pubm:byteflood
proc pubm:byteflood {nick host hand chan text} {
# ignore if bot not opped, ignore if its a chanop, ignore if the user has +bfmo globally or +fmo for the channel
if {(![botisop $chan]) || ([isop $nick $chan])} {return}
if {([validuser $hand]) && ([matchattr $hand +bfmo|fmo $chan])} {return}
# get the length of the text
set length [llength $text]
# ban mask
set bmask [maskhost "$nick!$host" 2]
# look up if we have them already in the time limit
set nick [string tolower $nick]
set chan [string tolower $chan]
if {[info exists ::bflood($chan:$nick)]} {
# increase the count by current length of text
set ::bflood($chan:$nick) [expr {$::bflood($chan:$nick) + $length}]
# check they haven't gone over the limit
if {($::bflood($chan:$nick) > $::bflood(maxlength))} {
# they have gone over the 'maxlength'
# devoice them if they are +v
if {[isvoice $nick $chan]} {pushmode $chan -v $nick}
# set the ban
putquick "MODE $chan +b $bmask"
# unset from array
unset ::bflood($chan:$nick)
# finished
return
}
# they haven't gone over the limit, lets set a timer
utimer $::bflood(unsettime) [list unset ::bflood($chan:$nick)]
# finished
return
# they are within the time limit
# we start again
} else {
# check we haven't already gone over the maxlength
if {($length >= $::bflood(maxlength))} {
# they have gone over the 'maxlength'
# devoice them if they are +v
if {[isvoice $nick $chan]} {pushmode $chan -v $nick}
# set the ban
putquick "MODE $chan +b $bmask"
# end here
return
}
# they are within the limit add to array and unset after ::bflood(unsettime)
set ::bflood($chan:$nick) $length
# set a time limit on them
utimer $::bflood(unsettime) [list unset ::bflood($chan:$nick)]
# finished
return
}
}
|
it keeps returning error and doesnt set ban:
Quote: |
Tcl error in script for 'timer111278':
can't unset "::bflood(#test:monnie)": no such element in array
|
|
|
Back to top |
|
 |
simo Revered One
Joined: 22 Mar 2015 Posts: 1027
|
Posted: Sat Jun 20, 2020 8:34 am Post subject: |
|
|
also isnt there a way to make each timer unique for each nick instead of having to set many timers per user per line to prevent duplicate timers for the same nick and end up with multiple unsets
so if timer is already running no need to add another one
from what i read this one keeps adding timers while there already is one running if i read correctly |
|
Back to top |
|
 |
simo Revered One
Joined: 22 Mar 2015 Posts: 1027
|
Posted: Sat Jun 20, 2020 8:44 am Post subject: |
|
|
if anyone could help with this it would be much apreciated |
|
Back to top |
|
 |
grumpy Voice

Joined: 10 Jan 2014 Posts: 9 Location: Europe/London
|
Posted: Sat Jun 20, 2020 9:52 am Post subject: |
|
|
Code: | # they haven't gone over the limit, lets set a timer
utimer $::bflood(unsettime) [list unset ::bflood($chan:$nick)] |
try commenting out this line, where it sets an other time after checking for them going over the limit. Should reduce it a bit hopefully |
|
Back to top |
|
 |
simo Revered One
Joined: 22 Mar 2015 Posts: 1027
|
Posted: Sat Jun 20, 2020 11:11 am Post subject: |
|
|
changed it and tested it doesnt trigger no matter the lines of text
this is what im working with so far:
Code: |
set ::bflood(maxlength) 300
set ::bflood(unsettime) 5
bind pubm - * pubm:byteflood
proc pubm:byteflood {nick host hand chan text} {
# ignore if bot not opped, ignore if its a chanop, ignore if the user has +bfmo globally or +fmo for the channel
if {(![botisop $chan]) || ([isop $nick $chan])} {return}
if {([validuser $hand]) && ([matchattr $hand +bfmo|fmo $chan])} {return}
# get the length of the text
set length [llength $text]
# ban mask
set bmask [maskhost "$nick!$host" 2]
# look up if we have them already in the time limit
set nick [string tolower $nick]
set chan [string tolower $chan]
if {[info exists ::bflood($chan:$nick)]} {
# increase the count by current length of text
set ::bflood($chan:$nick) [expr {$::bflood($chan:$nick) + $length}]
# check they haven't gone over the limit
if {($::bflood($chan:$nick) > $::bflood(maxlength))} {
# they have gone over the 'maxlength'
# devoice them if they are +v
if {[isvoice $nick $chan]} {pushmode $chan -v $nick}
# set the ban
putquick "MODE $chan +b $bmask"
# unset from array
unset ::bflood($chan:$nick)
# finished
return
}
# they haven't gone over the limit, lets set a timer
# utimer $::bflood(unsettime) [list unset ::bflood($chan:$nick)]
# finished
return
# they are within the time limit
# we start again
} else {
# check we haven't already gone over the maxlength
if {($length >= $::bflood(maxlength))} {
# they have gone over the 'maxlength'
# devoice them if they are +v
if {[isvoice $nick $chan]} {pushmode $chan -v $nick}
# set the ban
putquick "MODE $chan +b $bmask"
# end here
return
}
# they are within the limit add to array and unset after ::bflood(unsettime)
set ::bflood($chan:$nick) $length
# set a time limit on them
utimer $::bflood(unsettime) [list unset ::bflood($chan:$nick)]
# finished
return
}
}
|
|
|
Back to top |
|
 |
SpiKe^^ Owner

Joined: 12 May 2006 Posts: 826 Location: Tennessee, USA
|
Posted: Sat Jun 20, 2020 12:07 pm Post subject: Multi-line Text Flood |
|
|
I might try something a little more like this untested code...
Code: |
set bflood(maxlength) 300
set bflood(unsettime) 5
bind pubm - * pubm:byteflood
proc pubm:byteflood {nick host hand chan text} {
global bflood
if {![botisop $chan] || [isop $nick $chan]} { return 0 }
if {[validuser $hand] && [matchattr $hand +bfmo|fmo $chan]} { return 0 }
set nick [string tolower $nick]
set chan [string tolower $chan]
set length [string length $text]
if {[info exists bflood($chan:$nick)]} { incr length $bflood($chan:$nick) }
if {($length > $bflood(maxlength))} {
if {[isvoice $nick $chan]} { pushmode $chan -v $nick }
set bmask [maskhost "$nick!$host" 2]
putquick "MODE $chan +b $bmask"
array unset bflood $chan:$nick
return 0
}
if {![info exists bflood($chan:$nick)]} {
utimer $bflood(unsettime) [list array unset bflood $chan:$nick]
}
set bflood($chan:$nick) $length
return 0
}
|
_________________ SpiKe^^
Get BogusTrivia 2.06.4.7 at www.mytclscripts.com
or visit the New Tcl Acrhive at www.tclarchive.org
.
Last edited by SpiKe^^ on Sat Jun 20, 2020 12:54 pm; edited 1 time in total |
|
Back to top |
|
 |
simo Revered One
Joined: 22 Mar 2015 Posts: 1027
|
Posted: Sat Jun 20, 2020 12:34 pm Post subject: |
|
|
Excellent tested it and seems to work flawlessly thx SpiKe^^ apreciated as always
and ofcourse grumpy as well thnx for your efforts |
|
Back to top |
|
 |
simo Revered One
Joined: 22 Mar 2015 Posts: 1027
|
Posted: Sat Jun 20, 2020 1:09 pm Post subject: |
|
|
except for 1 part wich seems to bother me
this part:
Code: |
set length [string length $text]
if {[info exists bflood($chan:$nick)]} { incr length $bflood($chan:$nick) } |
would that mean if it exists any other nick can increase it rather than each nick to seperatly increase text on their own only |
|
Back to top |
|
 |
SpiKe^^ Owner

Joined: 12 May 2006 Posts: 826 Location: Tennessee, USA
|
Posted: Sat Jun 20, 2020 1:12 pm Post subject: |
|
|
No, that should be fine I think. _________________ SpiKe^^
Get BogusTrivia 2.06.4.7 at www.mytclscripts.com
or visit the New Tcl Acrhive at www.tclarchive.org
. |
|
Back to top |
|
 |
simo Revered One
Joined: 22 Mar 2015 Posts: 1027
|
Posted: Sat Jun 20, 2020 1:22 pm Post subject: |
|
|
my idea would be to check if the one setting the length in
set length [string length $text]
to check if nick is the same nick as the one in $bflood($chan:$nick) and only then to increase |
|
Back to top |
|
 |
SpiKe^^ Owner

Joined: 12 May 2006 Posts: 826 Location: Tennessee, USA
|
Posted: Sat Jun 20, 2020 1:26 pm Post subject: |
|
|
It does. Looks fine. But feel free to chop away at the code as you see fit:) _________________ SpiKe^^
Get BogusTrivia 2.06.4.7 at www.mytclscripts.com
or visit the New Tcl Acrhive at www.tclarchive.org
. |
|
Back to top |
|
 |
simo Revered One
Joined: 22 Mar 2015 Posts: 1027
|
Posted: Sat Jun 20, 2020 1:35 pm Post subject: |
|
|
excellent thanks again SpiKe^^ |
|
Back to top |
|
 |
|