If you type messages in chat rapidly enough, you'll start to get a cooldown:
I've been writing a chatbot library recently, and handling cooldowns is something that I've found a bit difficult. This library is what powers bots like Code Golf's New Posts and Sandbox Posts, which are important as they replace the feeds in Code Golf's main chat room. I've done close to an hour of experimenting with cooldowns, and I still can't tell what's going on.
I'd like to handle cooldowns in a way that prevents them from "stacking". Even after you wait out the cooldown, posting more messages quickly can cause it to return, often with a few seconds added. For bots with higher amounts of output, these cooldowns could chain, and enough messages could queue up during the previous cooldowns to freeze up the bot near permanently (this shouldn't happen in most applications, but because the cooldown is global, the right circumstances could definitely occur, such as in bots which respond to users' messages in multiple rooms).
I'm also slightly curious at this point, as while there's some obvious patterns to how the cooldowns work, it seems to occasionally just stop working the same way it did before, as if chat's just trying to mess with me.
I'm sure the specifics of how chat cooldowns work probably won't be revealed, since it could possibly be abused by spammers, but a little bit of information on how they work and how to avoid them causing issues would be really helpful.
isCurrentRateFine
that is used by KennyBot. It takes an array with timestamps the bot posted and then tries to work out if it will be rate limited. I heavily commented that function so it is rather easy to follow what it does. ..... slowly backs away ....