aboutsummaryrefslogtreecommitdiffstats
diff options
context:
space:
mode:
authorGravatar ks129 <[email protected]>2020-05-31 12:36:42 +0300
committerGravatar ks129 <[email protected]>2020-05-31 12:36:42 +0300
commitce2f97f8746ce01109dfac562640ac3e732bdb39 (patch)
treeac36870d1aa69d0fade071e62685e6613c2eda3c
parentFiltering: Split name filtering to smaller functions (diff)
parentFiltering: Create lock in `__init__` (diff)
Merge remote-tracking branch 'origin/bad-words-nick' into bad-words-nick
-rw-r--r--bot/cogs/filtering.py5
1 files changed, 1 insertions, 4 deletions
diff --git a/bot/cogs/filtering.py b/bot/cogs/filtering.py
index 4f1ad0986..eb587d781 100644
--- a/bot/cogs/filtering.py
+++ b/bot/cogs/filtering.py
@@ -62,7 +62,7 @@ class Filtering(Cog):
def __init__(self, bot: Bot):
self.bot = bot
- self.name_lock: Optional[asyncio.Lock] = None
+ self.name_lock = asyncio.Lock()
staff_mistake_str = "If you believe this was a mistake, please let staff know!"
self.filters = {
@@ -158,9 +158,6 @@ class Filtering(Cog):
async def check_is_bad_words_in_name(self, member: Member) -> None:
"""Check bad words from user display name. When there is more than 3 days after last alert, send new alert."""
- if not self.name_lock:
- self.name_lock = asyncio.Lock()
-
# Use lock to avoid race conditions
async with self.name_lock:
# Check does nickname have match in filters.