-
-
Notifications
You must be signed in to change notification settings - Fork 405
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
Plugin API: Add optional message to module.rate() #830
Comments
If one of the collaborators for this repo feels like assigning this to me, I just came across it while cleaning out my oldest issues in the GitHub dashboard view, and am reminded that this would still be useful to have (since the majority of my Sopel modules use bespoke rate-limiting that includes these features). |
Thanks for the reminder that this exists, @kwaaak. Assigning to Sopel 7 milestone, as it's an API change. |
Hmm, this is not going to be so nice to implement with the rework of Adding another optional I suppose long-term we could consider splitting |
NAK third parameter (OP edited); should always use NOTICE. |
Still not sure how to do that properly for so many different rate limits:
Or:
Or:
@dgw any opinion? |
Combination of 1 & 3, mostly so there's a way to add more specific messages if necessary: def rate(user=0, channel=0, server=0, message=None): # not deprecated
def rate_user(limit, message=None):
def rate_channel(limit, message=None):
def rate_server(limit, message=None): One consideration: I think it'd be good to implement the new decorators in such a way that they always take precedence over the generic @plugin.rate(7, 7, 7, "This must be Vegas!")
@plugin.rate_channel(3, "Little maids from school")
def plugin_thing(bot, trigger):
"""Allowed every 3 seconds per channel, not 7 seconds."""
pass Also: What about making both args to the Would be super cool to allow overriding the message for a rate limit type without even needing the No objection to putting this in 8.0, either, as there's plenty left for 7.1 as it is. |
Yeah OK it's getting quite complex and Sopel 8 will handle it, because Sopel 8 is 7.1 but better. |
Working on that, I already have a working solution, I just need to iron out the tests and the documentation. |
If set, send
message
as a notice to the calling user if the command was canceled due to rate-limit. Ideally, it would support a placeholder such as{time_left}
for the message to tell the user when they can use the command again.I'd be happy to code it up and PR it; just want to establish that it'd have a chance of being merged first, before putting in that time.
Could also have a third parameter to toggle between using NOTICE and PRIVMSG.The text was updated successfully, but these errors were encountered: