From 7e0f0c3fe4a287c903ce13363a6a6689368f95e8 Mon Sep 17 00:00:00 2001 From: TrustyJAID Date: Tue, 13 Feb 2024 20:11:37 -0700 Subject: [PATCH] [ExtendedModLog] Fix member leaving events erroring --- extendedmodlog/eventmixin.py | 11 +++++------ 1 file changed, 5 insertions(+), 6 deletions(-) diff --git a/extendedmodlog/eventmixin.py b/extendedmodlog/eventmixin.py index 373811b522..a1ad50a1cc 100644 --- a/extendedmodlog/eventmixin.py +++ b/extendedmodlog/eventmixin.py @@ -800,9 +800,9 @@ async def on_member_remove(self, member: discord.Member): # set guild level i18n time = datetime.datetime.now(datetime.timezone.utc) entry = await self.get_audit_log_entry(guild, member, discord.AuditLogAction.kick) - if entry is not None: - perp = entry.user - reason = entry.reason + + perp = getattr(entry, "user", None) + reason = getattr(entry, "reason", None) if embed_links: embed = discord.Embed( description=member, @@ -2333,9 +2333,8 @@ async def on_thread_update(self, before: discord.Thread, after: discord.Thread) entry = await self.get_audit_log_entry( guild, before, discord.AuditLogAction.channel_update ) - if entry is not None: - perp = entry.user - reason = entry.reason + perp = getattr(entry, "user", None) + reason = getattr(entry, "reason", None) if perp: msg += _("Updated by ") + str(perp) + "\n"