Skip to content

Commit

Permalink
[Def] Fix "coroutine never awaited" warn spam
Browse files Browse the repository at this point in the history
  • Loading branch information
Twentysix26 committed May 8, 2023
1 parent 18282f3 commit 095e621
Showing 1 changed file with 4 additions and 8 deletions.
12 changes: 4 additions & 8 deletions defender/core/events.py
Original file line number Diff line number Diff line change
Expand Up @@ -91,8 +91,7 @@ async def on_message(self, message: discord.Message):
inv_filter_enabled = await self.config.guild(guild).invite_filter_enabled()
if inv_filter_enabled and not is_staff:
inv_filter_rank = await self.config.guild(guild).invite_filter_rank()
wd_check = WardenAPI.eval_check(guild=guild, module=WDChecksKeys.InviteFilter, message=message, user=message.author)
if rank >= inv_filter_rank and await wd_check:
if rank >= inv_filter_rank and await WardenAPI.eval_check(guild=guild, module=WDChecksKeys.InviteFilter, message=message, user=message.author):
try:
expelled = await self.invite_filter(message)
except discord.Forbidden as e:
Expand All @@ -108,8 +107,7 @@ async def on_message(self, message: discord.Message):
rd_enabled = await self.config.guild(guild).raider_detection_enabled()
if rd_enabled and not is_staff:
rd_rank = await self.config.guild(guild).raider_detection_rank()
wd_check = WardenAPI.eval_check(guild=guild, module=WDChecksKeys.RaiderDetection, message=message, user=message.author)
if rank >= rd_rank and await wd_check:
if rank >= rd_rank and await WardenAPI.eval_check(guild=guild, module=WDChecksKeys.RaiderDetection, message=message, user=message.author):
try:
expelled = await self.detect_raider(message)
except discord.Forbidden as e:
Expand All @@ -134,8 +132,7 @@ async def on_message(self, message: discord.Message):

if ca_enabled and not is_staff:
rank_ca = await self.config.guild(guild).ca_rank()
wd_check = WardenAPI.eval_check(guild=guild, module=WDChecksKeys.CommentAnalysis, message=message, user=message.author)
if rank_ca and rank >= rank_ca and await wd_check:
if rank_ca and rank >= rank_ca and await WardenAPI.eval_check(guild=guild, module=WDChecksKeys.CommentAnalysis, message=message, user=message.author):
try:
await self.comment_analysis(message)
except asyncio.TimeoutError:
Expand Down Expand Up @@ -312,8 +309,7 @@ async def on_member_join(self, member: discord.Member):
log.error("Warden - unexpected error during actions execution", exc_info=e)

if await self.config.guild(guild).join_monitor_enabled():
wd_check = await WardenAPI.eval_check(guild=guild, module=WDChecksKeys.JoinMonitor, user=member)
if wd_check:
if await WardenAPI.eval_check(guild=guild, module=WDChecksKeys.JoinMonitor, user=member):
await self.join_monitor_flood(member)
await self.join_monitor_suspicious(member)

Expand Down

0 comments on commit 095e621

Please sign in to comment.