Firebot icon indicating copy to clipboard operation
Firebot copied to clipboard

[Feature Request] Command Rate Limit

Open CrowbarToolsRobot opened this issue 10 months ago • 2 comments

Description

Be nice if we could have a rate limit for commands rather than a straight cooldown. So only X number of uses per minute. As an example if the rate limit was 10 a minute then for every use it would increment the count 1, but every 6 seconds it would decrement the count 1. If it hit 10 you'd get a minute long cooldown. This would allow frequent use of a command in a short period, but stop the possibility of spam. Might be nice to have an adjustable cooldown too.

Submitted By

oshimia

Created via Discord.

CrowbarToolsRobot avatar Feb 08 '25 21:02 CrowbarToolsRobot

Something I wanted to ask for, but figured would get far too complicated too quickly, was a means of adding a "collective rate limit" that you could sign events/commands to, but I think I may have a reasonable approach.

Start with a time based event and add an associated counter. Have the time based event count down at a rate that would match "x per minute" as I described above, but stops at 0. Then in the cooldown section of a command add the option to +1 to the associated counter and go on cooldown if the counter is above x.

It'd be nice if you could also associate an event with the cooldown. Extra features that would be useful is to add a variable for the count so that it can be used in conditional effects, and an effect to add to the count without having to use a cooldown feature.

The use case for this is for API's that may have rate limits. If you want to use a single API for multiple possible commands/events then a simple cooldown may not be enough to stop your multiple commands/events going over the limit, meaning you'd either need to have very stringent cooldowns or multiple API keys. This would allow you to use a single API key with a strict rate limit across multiple commands/events. I've already built something to this effect for my own stuff, but it would be nice if it was built in.

Oshimia avatar Feb 13 '25 20:02 Oshimia

I have a plugin that does basically this, in case you may find it useful.

https://github.com/TheStaticMage/firebot-rate-limiter

TheStaticMage avatar Dec 10 '25 22:12 TheStaticMage