From eacf903abf9803027b426dd0ee68bebf6c22a3ed Mon Sep 17 00:00:00 2001 From: Leander Furumo Date: Tue, 3 Nov 2026 02:23:42 +0100 Subject: [PATCH] fix: show galtinn memberships without a type or end date Co-Authored-By: Claude Opus 5.5 --- src/cogs/galtinn.py | 9 ++++++--- 1 file changed, 6 insertions(+), 3 deletions(-) diff --git a/src/cogs/galtinn.py b/src/cogs/galtinn.py index 819774b..c67f88b 100644 --- a/src/cogs/galtinn.py +++ b/src/cogs/galtinn.py @@ -123,7 +123,8 @@ class Galtinn(commands.Cog): membership_status = "Har aldri vært medlem" else: membership_status = "Ja" if last_membership["is_valid"] else "Nei" - if last_membership["membership_type"] != "lifelong": + # Lifelong memberships have no end date + if last_membership["end_date"]: expiration_date = datetime.strptime(last_membership["end_date"], "%Y-%m-%d") expiration_date = misc_utils.localize(expiration_date, self.bot.timezone) expires = discord.utils.format_dt(expiration_date, "D") @@ -136,8 +137,10 @@ class Galtinn(commands.Cog): embed.description = f"<@{user['discord_profile']['discord_id']}>" embed.add_field(name="Medlem?", value=membership_status) if last_membership: - embed.add_field(name="Medlemskapstype", value=last_membership["membership_type"]) - if last_membership["membership_type"] != "lifelong": + # Galtinn leaves out the type for members of the groups it counts as members without a membership + if membership_type := last_membership.get("membership_type"): + embed.add_field(name="Medlemskapstype", value=membership_type) + if last_membership["end_date"]: embed.add_field(name="Gyldig til", value=f"{expires}\n{time_left}") await interaction.response.send_message(embed=embed, ephemeral=True)