aboutsummaryrefslogtreecommitdiff
diff options
context:
space:
mode:
authorRapptz <[email protected]>2017-08-27 16:59:04 -0400
committerRapptz <[email protected]>2017-08-27 16:59:04 -0400
commit63fcfa6d02af7063b9727a07d0aadf7a63918be7 (patch)
treec9dbaa8c777c52fc72b43d8f5eae585fe4b3c025
parent[commands] Export cooldown classes as well. (diff)
downloaddiscord.py-63fcfa6d02af7063b9727a07d0aadf7a63918be7.tar.xz
discord.py-63fcfa6d02af7063b9727a07d0aadf7a63918be7.zip
[commands] Add CooldownMapping.from_cooldown factory classmethod.
-rw-r--r--discord/ext/commands/cooldowns.py4
1 files changed, 4 insertions, 0 deletions
diff --git a/discord/ext/commands/cooldowns.py b/discord/ext/commands/cooldowns.py
index ebcdd69e..74146284 100644
--- a/discord/ext/commands/cooldowns.py
+++ b/discord/ext/commands/cooldowns.py
@@ -92,6 +92,10 @@ class CooldownMapping:
def valid(self):
return self._cooldown is not None
+ @classmethod
+ def from_cooldown(cls, rate, per, type):
+ return cls(Cooldown(rate, per, type))
+
def _bucket_key(self, ctx):
msg = ctx.message
bucket_type = self._cooldown.type