aboutsummaryrefslogtreecommitdiff
diff options
context:
space:
mode:
authorRapptz <[email protected]>2019-02-23 07:41:25 -0500
committerRapptz <[email protected]>2019-02-23 07:41:25 -0500
commit9827d6eeaf191fb4cd8a144388804617922f50f4 (patch)
tree1ca62915d2c7df6c412647f14106ed93513e0d3d
parent[commands] Fix bug with cog bot check once not being unloaded properly. (diff)
downloaddiscord.py-9827d6eeaf191fb4cd8a144388804617922f50f4.tar.xz
discord.py-9827d6eeaf191fb4cd8a144388804617922f50f4.zip
[commands] Fix issue with decorator order with checks and cooldowns
Now they're just explicitly copied.
-rw-r--r--discord/ext/commands/cooldowns.py5
-rw-r--r--discord/ext/commands/core.py4
2 files changed, 9 insertions, 0 deletions
diff --git a/discord/ext/commands/cooldowns.py b/discord/ext/commands/cooldowns.py
index ae48b284..9687d5f6 100644
--- a/discord/ext/commands/cooldowns.py
+++ b/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
diff --git a/discord/ext/commands/core.py b/discord/ext/commands/core.py
index b980b92f..45c3eb80 100644
--- a/discord/ext/commands/core.py
+++ b/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: