[commands] Allow passing current to more cooldown mapping methods.

Also adds a CooldownMapping.update_rate_limit helper function.
This commit is contained in:
Rapptz
2019-04-24 23:23:51 -04:00
parent d80d4145b1
commit 6dcd68b8d7
2 changed files with 9 additions and 5 deletions

View File

@ -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)