aboutsummaryrefslogtreecommitdiff
diff options
context:
space:
mode:
authorRapptz <[email protected]>2021-04-11 01:00:04 -0400
committerRapptz <[email protected]>2021-04-11 01:00:04 -0400
commit1ecadf057ed21add313920badde8d8e525a485c2 (patch)
treed19b56278834d1dd3d79900deebac2ce26a05f9f
parentRemove Member related handling in PRESENCE_UPDATE (diff)
downloaddiscord.py-1ecadf057ed21add313920badde8d8e525a485c2.tar.xz
discord.py-1ecadf057ed21add313920badde8d8e525a485c2.zip
[commands] Fix errors with cooldown mappings
-rw-r--r--discord/ext/commands/cooldowns.py9
1 files changed, 7 insertions, 2 deletions
diff --git a/discord/ext/commands/cooldowns.py b/discord/ext/commands/cooldowns.py
index cb0f75cf..d7fe404f 100644
--- a/discord/ext/commands/cooldowns.py
+++ b/discord/ext/commands/cooldowns.py
@@ -140,7 +140,7 @@ class CooldownMapping:
self._type = type
def copy(self):
- ret = CooldownMapping(self._cooldown)
+ ret = CooldownMapping(self._cooldown, self._type)
ret._cache = self._cache.copy()
return ret
@@ -150,7 +150,7 @@ class CooldownMapping:
@classmethod
def from_cooldown(cls, rate, per, type):
- return cls(Cooldown(rate, per, type))
+ return cls(Cooldown(rate, per), type)
def _bucket_key(self, msg):
return self._type(msg)
@@ -192,6 +192,11 @@ class DynamicCooldownMapping(CooldownMapping):
super().__init__(None, type)
self._factory = factory
+ def copy(self):
+ ret = DynamicCooldownMapping(self._factory, self._type)
+ ret._cache = self._cache.copy()
+ return ret
+
@property
def valid(self):
return True