|
|
@ -31,8 +31,9 @@ __all__ = ['BucketType', 'Cooldown', 'CooldownMapping'] |
|
|
|
class BucketType(enum.Enum): |
|
|
|
default = 0 |
|
|
|
user = 1 |
|
|
|
guild = 2 |
|
|
|
guild = 2 |
|
|
|
channel = 3 |
|
|
|
member = 4 |
|
|
|
|
|
|
|
class Cooldown: |
|
|
|
__slots__ = ('rate', 'per', 'type', '_window', '_tokens', '_last') |
|
|
@ -111,6 +112,8 @@ class CooldownMapping: |
|
|
|
return (msg.guild or msg.author).id |
|
|
|
elif bucket_type is BucketType.channel: |
|
|
|
return msg.channel.id |
|
|
|
elif bucket_type is BucketType.member: |
|
|
|
return ((msg.guild and msg.guild.id), msg.author.id) |
|
|
|
|
|
|
|
def _verify_cache_integrity(self): |
|
|
|
# we want to delete all cache objects that haven't been used |
|
|
|