sharding (blacklists): Blacklist shard support.

Moved the `user_blacklist` and `guild_blacklist` to a client TTL cache.
This commit is contained in:
2021-12-22 13:07:20 +02:00
parent 20697c4823
commit 1c05d7a880
10 changed files with 48 additions and 47 deletions

View File

@@ -82,7 +82,7 @@ class LionModule(Module):
raise SafeCancellation(details="Module '{}' is not ready.".format(self.name))
# Check global user blacklist
if ctx.author.id in ctx.client.objects['blacklisted_users']:
if ctx.author.id in ctx.client.user_blacklist():
raise SafeCancellation(details='User is blacklisted.')
if ctx.guild:
@@ -91,7 +91,7 @@ class LionModule(Module):
raise SafeCancellation(details='Command channel is no longer reachable.')
# Check global guild blacklist
if ctx.guild.id in ctx.client.objects['blacklisted_guilds']:
if ctx.guild.id in ctx.client.guild_blacklist():
raise SafeCancellation(details='Guild is blacklisted.')
# Check guild's own member blacklist