diff --git a/redbot/core/core_commands.py b/redbot/core/core_commands.py index 8878e2c4d..4cae03451 100644 --- a/redbot/core/core_commands.py +++ b/redbot/core/core_commands.py @@ -2749,6 +2749,21 @@ class Core(commands.Cog, CoreLogic): return msg +# DEP-WARN: CooldownMapping should have a method `from_cooldown` +# which accepts (number, number, bucket) +# the bucket should only be used for the method `_bucket_key` +# and `_bucket_key` should be used to determine the grouping +# of ratelimit consumption. +class LicenseCooldownMapping(commands.CooldownMapping): + """ + This is so that a single user can't spam a channel with this + it's used below as 1 per 3 minutes per user-channel combination. + """ + + def _bucket_key(self, msg): + return (msg.channel.id, msg.author.id) + + # Removing this command from forks is a violation of the GPLv3 under which it is licensed. # Otherwise interfering with the ability for this command to be accessible is also a violation. @commands.command( @@ -2770,3 +2785,9 @@ async def license_info_command(ctx): ) await ctx.send(message) # We need a link which contains a thank you to other projects which we use at some point. + + +# DEP-WARN: command objects should store a single cooldown mapping as `._buckets` +license_info_command._buckets = LicenseCooldownMapping.from_cooldown( + 1, 180, commands.BucketType.member # pick a random bucket,it wont get used. +)