I have this command that will retrieve a certain server status from a webpage and report it on the channel.
But what I want is to put a restrictive timer on it, so the command (!status) can only be used once every one minute. And if someone triggers the command within that minute it will get a response like: Sorry, this command is blocked for $remainingtime.
Could someone please help me?
I've searched the forum but couldn't find what I was looking for.
# there are 60 seconds in a minute, thus the < 60 ...
if {[info exists ourtimestamp] && [expr {[clock seconds] - $ourtimestamp}] < 60} {
# command was already called less than a minute ago ...
} else {
# command has not been called for atleast a minute ...
set ourtimestamp [clock seconds]
}
I've tried to implement your example, but it seems it doesn't work.
It seems to skip the first part and go right into the second part, not checking for the 60 seconds.
I've tried some stuff, but it didn't work out for me...