aboutsummaryrefslogtreecommitdiff
path: root/discord/ext/commands/cooldowns.py
diff options
context:
space:
mode:
authorDan Hess <[email protected]>2016-09-06 15:03:47 -0500
committerRapptz <[email protected]>2016-09-08 07:02:33 -0400
commitb7ffbca0c781ae88e2593c5ebb2a063e7d4e2253 (patch)
treedafbe1377d3c003571e42e7e6456edba54c3a21e /discord/ext/commands/cooldowns.py
parentFix gateway code to work with websockets 3.2. (diff)
downloaddiscord.py-b7ffbca0c781ae88e2593c5ebb2a063e7d4e2253.tar.xz
discord.py-b7ffbca0c781ae88e2593c5ebb2a063e7d4e2253.zip
[commands] Added a method to reset command cooldown.
Diffstat (limited to 'discord/ext/commands/cooldowns.py')
-rw-r--r--discord/ext/commands/cooldowns.py5
1 files changed, 5 insertions, 0 deletions
diff --git a/discord/ext/commands/cooldowns.py b/discord/ext/commands/cooldowns.py
index 035ac809..c1aa10a7 100644
--- a/discord/ext/commands/cooldowns.py
+++ b/discord/ext/commands/cooldowns.py
@@ -43,6 +43,7 @@ class Cooldown:
self.type = type
self._window = 0.0
self._tokens = self.rate
+ self._last = 0.0
if not isinstance(self.type, BucketType):
raise TypeError('Cooldown type must be a BucketType')
@@ -72,6 +73,10 @@ class Cooldown:
if self._tokens == 0:
self._window = current
+ def reset(self):
+ self._tokens = self.rate
+ self._last = 0.0
+
def copy(self):
return Cooldown(self.rate, self.per, self.type)