mirror of
https://github.com/Cog-Creators/Red-DiscordBot.git
synced 2025-11-06 03:08:55 -05:00
[Filter] Fix cache invalidation (#2810)
This commit is contained in:
parent
bff7e214ab
commit
8637f8a852
@ -286,6 +286,10 @@ class Filter(commands.Cog):
|
|||||||
def invalidate_cache(self, guild: discord.Guild, channel: discord.TextChannel = None):
|
def invalidate_cache(self, guild: discord.Guild, channel: discord.TextChannel = None):
|
||||||
""" Invalidate a cached pattern"""
|
""" Invalidate a cached pattern"""
|
||||||
self.pattern_cache.pop((guild, channel), None)
|
self.pattern_cache.pop((guild, channel), None)
|
||||||
|
if channel is None:
|
||||||
|
for keyset in list(self.pattern_cache.keys()): # cast needed, no remove
|
||||||
|
if guild in keyset:
|
||||||
|
self.pattern_cache.pop(keyset, None)
|
||||||
|
|
||||||
async def add_to_filter(
|
async def add_to_filter(
|
||||||
self, server_or_channel: Union[discord.Guild, discord.TextChannel], words: list
|
self, server_or_channel: Union[discord.Guild, discord.TextChannel], words: list
|
||||||
|
|||||||
Loading…
x
Reference in New Issue
Block a user