[commands] allow arbitrary callables in cooldown

This commit is contained in:
Mikey authored and GitHub committed 2021-03-28 06:31:51 -04:00
1 parent baa1ab058b
commit d61486278f
2 files changed
+11 -5

No files matched your search

+5 -2
View File
@@ -1959,8 +1959,11 @@ def cooldown(rate, per, type=BucketType.default):
The number of times a command can be used before triggering a cooldown.
per: :class:`float`
The amount of seconds to wait for a cooldown when it's been triggered.
type: :class:`.BucketType`
The type of cooldown to have.
type: Union[:class:`.BucketType`, Callable[[:class:`.Message`], Any]]
The type of cooldown to have. If callable, should return a key for the mapping.
.. versionchanged:: 1.7
Callables are now supported for custom bucket types.
"""
def decorator(func):