[commands] Add CooldownMapping.from_cooldown factory classmethod.

This commit is contained in:
Rapptz 2017-08-27 16:59:04 -04:00
parent 1c967e9a7c
commit 63fcfa6d02

View File

@ -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