Code: Select all
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
}
}
Code: Select all
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
}
}
Tcl error in script for 'timer111278':
can't unset "::bflood(#test:monnie)": no such element in array
Code: Select all
# they haven't gone over the limit, lets set a timer
utimer $::bflood(unsettime) [list unset ::bflood($chan:$nick)]
Code: Select all
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
}
}
Code: Select all
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
}
Code: Select all
set length [string length $text]
if {[info exists bflood($chan:$nick)]} { incr length $bflood($chan:$nick) }