Skip to content

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

@dgw

Description

@dgw

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

Metadata

Metadata

Assignees

No one assigned

    Labels

    FeatureNeeds TriageIssues that need to be reviewed and categorized

    Projects

    No projects

    Milestone

    No milestone

    Relationships

    None yet

    Development

    No branches or pull requests

    Issue actions