diff options
| author | Rapptz <[email protected]> | 2017-08-27 16:59:04 -0400 |
|---|---|---|
| committer | Rapptz <[email protected]> | 2017-08-27 16:59:04 -0400 |
| commit | 63fcfa6d02af7063b9727a07d0aadf7a63918be7 (patch) | |
| tree | c9dbaa8c777c52fc72b43d8f5eae585fe4b3c025 | |
| parent | [commands] Export cooldown classes as well. (diff) | |
| download | discord.py-63fcfa6d02af7063b9727a07d0aadf7a63918be7.tar.xz discord.py-63fcfa6d02af7063b9727a07d0aadf7a63918be7.zip | |
[commands] Add CooldownMapping.from_cooldown factory classmethod.
| -rw-r--r-- | discord/ext/commands/cooldowns.py | 4 |
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 |