on @*:text:*:#YOURCHAN: floodchk
on @*:action:*:#YOURCHAN: floodchk
on @*:notice:*:#YOURCHAN: floodchk
alias -l floodchk {
; ###### start of setup ######
/*
how to check for flooding. You can use:
$!nick to track acc. to a nickname
$!site to track acc. to the user's host
$!address to track acc. to "ident@host"
$!fulladdress to track acc. to "nick!ident@host"
*/
var %check = $!nick
; kick for N lines per N seconds
var %lines = 3
var %seconds = 5
; issue a kickban after N repeated kicks for flooding. If you set it to 0 it will never ban
var %kickstoban = 3
; repeated kicks will be "forgotten" N seconds after the last kick
; (so you don't ban a user for "repeated flooding", if it was yesterday)
var %unsetkicks = 600
; ###### end of setup ######
hadd $+(-mu,%seconds) $+(floodcheck,.,$cid) $+($chan,.,%check,.,$rand(1,999999))
if ($hfind($+(floodcheck,.,$cid),$+($chan,.,%check,.*),0,w) >= %lines) {
if (%kickstoban) {
hinc $+(-mu,%unsetkicks) $+(floodcheck.kicks,.,$cid) $+($chan,.,%check)
if ($hget($+(floodcheck.kicks,.,$cid),$+($chan,.,%check)) > %kickstoban) {
BAN -k $chan $nick 1 Don't flood! (Limit is %lines lines per %seconds seconds)
hdel $+(floodcheck.kicks,.,$cid) $+($chan,.,%check)
return
}
}
KICK $chan $nick Don't flood! (Limit is %lines lines per %seconds seconds)
hdel -w $+(floodcheck,.,$cid) $+($chan,.,%check,.*)
}
}