[commands] Use message creation as the reference time in cooldowns
This commit is contained in:
parent
ec7a701ceb
commit
7a1102ccf0
@ -28,6 +28,7 @@ import asyncio
|
|||||||
import functools
|
import functools
|
||||||
import inspect
|
import inspect
|
||||||
import typing
|
import typing
|
||||||
|
import datetime
|
||||||
|
|
||||||
import discord
|
import discord
|
||||||
|
|
||||||
@ -639,7 +640,8 @@ class Command(_BaseCommand):
|
|||||||
def _prepare_cooldowns(self, ctx):
|
def _prepare_cooldowns(self, ctx):
|
||||||
if self._buckets.valid:
|
if self._buckets.valid:
|
||||||
bucket = self._buckets.get_bucket(ctx.message)
|
bucket = self._buckets.get_bucket(ctx.message)
|
||||||
retry_after = bucket.update_rate_limit()
|
current = ctx.message.created_at.replace(tzinfo=datetime.timezone.utc).timestamp()
|
||||||
|
retry_after = bucket.update_rate_limit(current)
|
||||||
if retry_after:
|
if retry_after:
|
||||||
raise CommandOnCooldown(bucket, retry_after)
|
raise CommandOnCooldown(bucket, retry_after)
|
||||||
|
|
||||||
|
Loading…
x
Reference in New Issue
Block a user