What i need is very simple. When someone says the same thing, 3 times in 5 seconds, then the bot puts a channel ban. I have already searched, and there is no such script. Can someone do it for me pls?
Code: Select all
# Number of repeats before kicking
set repeatkick 3
# In how many seconds
set repeattime 30
# Also ban?
set repeatban 1
# Don't edit below unless you know what you're doing
bind pubm - * repeat_pubm
bind ctcp - ACTION repeat_action
bind nick - * repeat_nick
proc repeat_pubm {nick uhost hand chan text} {
if {[matchattr $nick mo|mo $chan] || [isop $nick $chan] || [isvoice $nick $chan] || [matchattr $nick o|o $chan]} {return 0}
global repeat_last repeat_num repeatkick repeatban repeatbantime
if [info exists repeat_last([set n [string tolower $nick]])] {
if {[string compare [string tolower $repeat_last($n)] \
[string tolower $text]] == 0} {
if {[incr repeat_num($n)] >= ${repeatkick}} {
if {$repeatban} {
set banmask "*!*[string range $uhost [string first "@" $uhost] end]"
pushmode $chan +b $banmask
puthelp "KICK $chan $nick :Repeating "
}
unset repeat_last($n)
unset repeat_num($n)
}
return
}
}
set repeat_num($n) 1
set repeat_last($n) $text
}
proc repeat_action {nick uhost hand dest keyword text} {
if {[matchattr $nick mo|mo $dest] || [isop $nick $dest] || [isvoice $nick $dest] || [matchattr $nick o|o $dest]} {return 0}
global botnick altnick repeat_last repeat_num repeatkick repeatban repeatbantime
if [info exists repeat_last([set n [string tolower $nick]])] {
if {[string compare [string tolower $repeat_last($n)] \
[string tolower $text]] == 0} {
if {[incr repeat_num($n)] >= ${repeatkick}} {
if {$repeatban} {
set banmask "*!*[string range $uhost [string first "@" $uhost] end]"
}
unset repeat_last($n)
unset repeat_num($n)
}
return
}
}
set repeat_num($n) 1
set repeat_last($n) $text
}
proc repeat_nick {nick uhost hand chan newnick} {
if {[matchattr $nick mo|mo $chan] || [isop $nick $chan] || [isvoice $nick $chan] || [matchattr $nick o|o $chan]} {return 0}
global repeat_last repeat_num
catch {set repeat_last([set nn [string tolower $newnick]]) \
$repeat_last([set on [string tolower $nick]])}
catch {unset repeat_last($on)}
catch {set repeat_num($nn) $repeat_num($on)}
catch {unset repeat_num($on)}
}
proc repeat_timr {} {
global repeat_last repeattime
catch {unset repeat_last}
catch {unset repeat_num}
utimer $repeattime repeat_timr
}
if ![regexp repeat_timr [utimers]] {
utimer $repeattime repeat_timr
}
putlog "=====>> Repeat Protection Loaded"