From 7d782690c527d25c83dfba6a22f04d36b7598fbe Mon Sep 17 00:00:00 2001 From: Leander Furumo Date: Fri, 23 Oct 2026 02:46:23 +0200 Subject: [PATCH] show an error instead of crashing when galtinn can't be reached in register and delete Co-Authored-By: Claude Opus 5.5 --- bot/src/cogs/galtinn.py | 8 ++++++++ 1 file changed, 8 insertions(+) diff --git a/bot/src/cogs/galtinn.py b/bot/src/cogs/galtinn.py index 0067166..41c26aa 100644 --- a/bot/src/cogs/galtinn.py +++ b/bot/src/cogs/galtinn.py @@ -617,6 +617,10 @@ class Galtinn(commands.Cog): # Check if user is already registered discord_profile = await self.fetch_galtinn_discordprofiles(discord_id=interaction.user.id) + if discord_profile is None: + embed = embed_templates.error_fatal("Klarte ikke å hente data fra Galtinn. Prøv igjen senere!") + await interaction.followup.send(embed=embed) + return # API guarantees that there is only one or zero results so this is safe if discord_profile.count == 1: embed = embed_templates.error_warning("Du er allerede registrert!") @@ -690,6 +694,10 @@ class Galtinn(commands.Cog): # Check if user exists galtinn_users = await self.fetch_galtinn_users(discord_id=interaction.user.id) + if galtinn_users is None: + embed = embed_templates.error_fatal("Klarte ikke å hente data fra Galtinn. Prøv igjen senere!") + await interaction.followup.send(embed=embed) + return # API guarantees that there is only one or zero results so this is safe if galtinn_users.count == 0: embed = embed_templates.error_warning("Du er ikke registrert!")