Hello.
I run a tcl script which answers users ctcp triggers.
I wonder how to make the script ignore a trigger from one specific user for a 3 mns period.
In fact, I dont want to ignore user completely.
I would need to only ignore his ctcp search trigger for some time but allow him to do other things with the bot.
proc throttled {id seconds} {
global throttle
if {[info exists throttle($id)]&&$throttle($id)>[clock sec]} {
set id 1
} {
set throttle($id) [expr {[clock sec]+$seconds}]
set id 0
}
}
# delete expired entries every 10 minutes
bind time - ?0* throttledCleanup
proc throttledCleanup args {
global throttle
set now [clock sec]
foreach {id time} [array get throttle] {
if {$time<=$now} {unset throttle($id)}
}
}