Browse Source

[commands] Fix issue with decorator order with checks and cooldowns

Now they're just explicitly copied.
pull/1929/head
Rapptz 6 years ago
parent
commit
9827d6eeaf
  1. 5
      discord/ext/commands/cooldowns.py
  2. 4
      discord/ext/commands/core.py

5
discord/ext/commands/cooldowns.py

@ -98,6 +98,11 @@ class CooldownMapping:
self._cache = {}
self._cooldown = original
def copy(self):
ret = CooldownMapping(self._cooldown)
ret._cache = self._cache.copy()
return ret
@property
def valid(self):
return self._cooldown is not None

4
discord/ext/commands/core.py

@ -268,6 +268,10 @@ class Command(_BaseCommand):
ret = self.__class__(self.callback, **self.__original_kwargs__)
ret._before_invoke = self._before_invoke
ret._after_invoke = self._after_invoke
if self.checks != ret.checks:
ret.checks = self.checks.copy()
if self._buckets != ret._buckets:
ret._buckets = self._buckets.copy()
try:
ret.on_error = self.on_error
except AttributeError:

Loading…
Cancel
Save