[commands] Allow passing current
to more cooldown mapping methods.
Also adds a CooldownMapping.update_rate_limit helper function.
This commit is contained in:
@ -664,8 +664,8 @@ class Command(_BaseCommand):
|
||||
|
||||
def _prepare_cooldowns(self, ctx):
|
||||
if self._buckets.valid:
|
||||
bucket = self._buckets.get_bucket(ctx.message)
|
||||
current = ctx.message.created_at.replace(tzinfo=datetime.timezone.utc).timestamp()
|
||||
bucket = self._buckets.get_bucket(ctx.message, current)
|
||||
retry_after = bucket.update_rate_limit(current)
|
||||
if retry_after:
|
||||
raise CommandOnCooldown(bucket, retry_after)
|
||||
|
Reference in New Issue
Block a user