Skip to content
New issue

Have a question about this project? Sign up for a free GitHub account to open an issue and contact its maintainers and the community.

By clicking “Sign up for GitHub”, you agree to our terms of service and privacy statement. We’ll occasionally send you account related emails.

Already on GitHub? Sign in to your account

"Lazy" rate-limit decorators with settings support #2666

Open
dgw opened this issue Mar 8, 2025 · 0 comments
Open

"Lazy" rate-limit decorators with settings support #2666

dgw opened this issue Mar 8, 2025 · 0 comments
Labels
Feature Needs Triage Issues that need to be reviewed and categorized

Comments

@dgw
Copy link
Member

dgw commented Mar 8, 2025

Requested Feature

Similar to #2632 (for @plugin.interval). This proposes adding _lazy versions of the existing rate* decorators that take the bot.settings.

Problems Solved

This weekend I wrote a command that needs channel rate-limiting not to prevent overloading anything, but just to prevent users from spamming a command with several lines of output.

Bot owners other than myself might reasonably want to lengthen or shorten the cooldown period, without editing the plugin source code.

Alternatives

  1. Clone/fork the plugin and edit its source code
    Less than ideal because the bot owner is now on the hook for pulling in upstream changes, either with Git or manually.
  2. Ignore the bot's rate-limiting features and implement bespoke logic
    I haven't completely decided against doing this in a closer-to-1.0 version of my new plugin, but it's tedious to duplicate most of what core does (keep track of last usage time, check against current time, send feedback to the user if the limit is enforced) just to replace a single value in the calculation with a different variable.\

Notes

No response

@dgw dgw added Feature Needs Triage Issues that need to be reviewed and categorized labels Mar 8, 2025
Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment
Labels
Feature Needs Triage Issues that need to be reviewed and categorized
Projects
None yet
Development

No branches or pull requests

1 participant