From a57cbef73dc1cc1562d911a2e83264f4efd8ed7b Mon Sep 17 00:00:00 2001 From: shtlrs Date: Sat, 9 Dec 2023 16:37:38 +0100 Subject: do not edit discord timeout for users who left the server if a user isn't a member of the server, trying to edit their timeout will result in an error --- bot/exts/moderation/infraction/management.py | 2 +- 1 file changed, 1 insertion(+), 1 deletion(-) diff --git a/bot/exts/moderation/infraction/management.py b/bot/exts/moderation/infraction/management.py index 9fd851245..0a33c84ab 100644 --- a/bot/exts/moderation/infraction/management.py +++ b/bot/exts/moderation/infraction/management.py @@ -232,7 +232,7 @@ class ModManagement(commands.Cog): if request_data["expires_at"]: self.infractions_cog.schedule_expiration(new_infraction) # Timeouts are handled by Discord itself, so we need to edit the expiry in Discord as well - if infraction["type"] == "timeout": + if user and infraction["type"] == "timeout": await user.edit(reason=reason, timed_out_until=expiry) log_text += f""" -- cgit v1.2.3