diff options
| author | 2022-02-14 01:51:23 +0000 | |
|---|---|---|
| committer | 2022-02-16 22:12:05 +0000 | |
| commit | 6c139905cca53f7810a100435955ec0c5fbc30e1 (patch) | |
| tree | 462f81cf404c290a565149778a3ad0b2475e280c | |
| parent | Add tests for new CleanBan and Clean functionality (diff) | |
Send error when cleanban fails to ban
Co-authored-by: GDWR <[email protected]>
| -rw-r--r-- | bot/exts/moderation/infraction/infractions.py | 4 | ||||
| -rw-r--r-- | tests/bot/exts/moderation/infraction/test_infractions.py | 2 | 
2 files changed, 4 insertions, 2 deletions
| diff --git a/bot/exts/moderation/infraction/infractions.py b/bot/exts/moderation/infraction/infractions.py index 32ff376cf..09ee1a7b4 100644 --- a/bot/exts/moderation/infraction/infractions.py +++ b/bot/exts/moderation/infraction/infractions.py @@ -113,12 +113,14 @@ class Infractions(InfractionScheduler, commands.Cog):          clean_cog: t.Optional[Clean] = self.bot.get_cog("Clean")          if clean_cog is None:              # If we can't get the clean cog, fall back to native purgeban. -            await self.apply_ban(ctx, user, reason, 1, expires_at=duration) +            await self.apply_ban(ctx, user, reason, purge_days=1, expires_at=duration)              return          infraction = await self.apply_ban(ctx, user, reason, expires_at=duration)          if not infraction or not infraction.get("id"):              # Ban was unsuccessful, quit early. +            await ctx.send(":x: Failed to apply ban.") +            log.error("Failed to apply ban to user %d", user.id)              return          # Calling commands directly skips Discord.py's convertors, so we need to convert args manually. diff --git a/tests/bot/exts/moderation/infraction/test_infractions.py b/tests/bot/exts/moderation/infraction/test_infractions.py index 57235ec6d..8845fb382 100644 --- a/tests/bot/exts/moderation/infraction/test_infractions.py +++ b/tests/bot/exts/moderation/infraction/test_infractions.py @@ -271,7 +271,7 @@ class CleanBanTests(unittest.IsolatedAsyncioTestCase):              self.ctx,              self.user,              "FooBar", -            1, +            purge_days=1,              expires_at=None,          ) | 
