From ae74f78899ce796427442521a96ec605fa381138 Mon Sep 17 00:00:00 2001 From: Dustin Rouillard Date: Wed, 18 Sep 2024 14:55:13 -0600 Subject: [PATCH] Clean up the clan identity update --- lib/presence/presence.ex | 18 ++++-------------- 1 file changed, 4 insertions(+), 14 deletions(-) diff --git a/lib/presence/presence.ex b/lib/presence/presence.ex index dab2c49..c78bc67 100644 --- a/lib/presence/presence.ex +++ b/lib/presence/presence.ex @@ -184,21 +184,11 @@ defmodule Lanyard.Presence do has_presence? = raw_data.discord_presence !== nil discord_user = - if raw_data.discord_user.clan != nil do - user_clan = - Map.put( - raw_data.discord_user.clan, - :identity_guild_id, - "#{raw_data.discord_user.clan.identity_guild_id}" - ) - - Map.put( - raw_data.discord_user, - :clan, - user_clan - ) + with %{clan: %{identity_guild_id: guild_id} = clan} <- raw_data.discord_user do + updated_clan = Map.put(clan, :identity_guild_id, "#{guild_id}") + Map.put(raw_data.discord_user, :clan, updated_clan) else - raw_data.discord_user + _ -> raw_data.discord_user end pretty_fields =