aboutsummaryrefslogtreecommitdiffstats
diff options
context:
space:
mode:
authorGravatar Boris Muratov <[email protected]>2023-04-05 01:57:35 +0300
committerGravatar Boris Muratov <[email protected]>2023-04-05 01:57:35 +0300
commit0a51bbe41279ac884b0e713c53590e612b79683a (patch)
tree2cbdb9cf8ed539f9f036aeb10a060ef75e4f3e3c
parentHandle server possibly not having an icon (diff)
Handle infracted user not being on the server
This shouldn't happen in production, but just in case
-rw-r--r--bot/exts/filtering/_settings_types/actions/infraction_and_notification.py7
1 files changed, 7 insertions, 0 deletions
diff --git a/bot/exts/filtering/_settings_types/actions/infraction_and_notification.py b/bot/exts/filtering/_settings_types/actions/infraction_and_notification.py
index 3b59c2feb..a7fb37ca9 100644
--- a/bot/exts/filtering/_settings_types/actions/infraction_and_notification.py
+++ b/bot/exts/filtering/_settings_types/actions/infraction_and_notification.py
@@ -101,6 +101,13 @@ class Infraction(Enum):
member = await get_or_fetch_member(channel.guild, user.id)
if member:
user = member
+ else:
+ log.warning(
+ f"The user {user} were set to receive an automatic {command_name}, "
+ "but they were not found in the guild."
+ )
+ return
+
ctx = FakeContext(message, channel, command)
if self.name in ("KICK", "WARNING", "WATCH", "NOTE"):
await command(ctx, user, reason=reason or None)