From 3dcc6379202735abed10f3d77668674dcf7a4bc8 Mon Sep 17 00:00:00 2001 From: Seaswimmer Date: Fri, 24 May 2024 04:15:27 -0400 Subject: [PATCH] fix(aurora): avoid keyerrors --- aurora/utilities/factory.py | 13 +++++++------ 1 file changed, 7 insertions(+), 6 deletions(-) diff --git a/aurora/utilities/factory.py b/aurora/utilities/factory.py index f7568d9..282e02d 100644 --- a/aurora/utilities/factory.py +++ b/aurora/utilities/factory.py @@ -187,18 +187,19 @@ async def case_factory(interaction: Interaction, moderation: Moderation) -> Embe embed.description += f"\n**Role:** {role.name}" if moderation.metadata: - if moderation.metadata["imported_from"]: - del moderation.metadata["imported_from"] + if moderation.metadata.get("imported_from"): embed.description += ( f"\n**Imported From:** {moderation.metadata['imported_from']}" ) - if moderation.metadata["imported_timestamp"]: - del moderation.metadata["imported_timestamp"] + moderation.metadata.pop("imported_from") + if moderation.metadata.get("imported_timestamp"): embed.description += ( f"\n**Imported Timestamp:** | " ) - for key, value in moderation.metadata.items(): - embed.description += f"\n**{key.title()}:** {value}" + moderation.metadata.pop("imported_timestamp") + if moderation.metadata.items(): + for key, value in moderation.metadata.items(): + embed.description += f"\n**{key.title()}:** {value}" embed.add_field(name="Reason", value=box(moderation.reason), inline=False)