diff --git a/PluralKit.Core/Database/Functions/ProxyMember.cs b/PluralKit.Core/Database/Functions/ProxyMember.cs index 9466edc8..c6c96dfc 100644 --- a/PluralKit.Core/Database/Functions/ProxyMember.cs +++ b/PluralKit.Core/Database/Functions/ProxyMember.cs @@ -11,7 +11,20 @@ namespace PluralKit.Core public int Id { get; set; } public IReadOnlyCollection ProxyTags { get; set; } = new ProxyTag[0]; public bool KeepProxy { get; set; } - public string ProxyName { get; set; } = ""; - public string? ProxyAvatar { get; set; } + + public string? ServerName { get; set; } + public string? DisplayName { get; set; } + public string Name { get; set; } = ""; + public string? SystemTag { get; set; } + + public string? ServerAvatar { get; set; } + public string? Avatar { get; set; } + public string? SystemIcon { get; set; } + + public string ProxyName => SystemTag != null + ? $"{ServerName ?? DisplayName ?? Name} {SystemTag}" + : ServerName ?? DisplayName ?? Name; + + public string? ProxyAvatar => ServerAvatar ?? Avatar ?? SystemIcon; } } \ No newline at end of file diff --git a/PluralKit.Core/Database/Functions/functions.sql b/PluralKit.Core/Database/Functions/functions.sql index 4b65afd0..2be38f5d 100644 --- a/PluralKit.Core/Database/Functions/functions.sql +++ b/PluralKit.Core/Database/Functions/functions.sql @@ -49,8 +49,15 @@ create function proxy_members(account_id bigint, guild_id bigint) id int, proxy_tags proxy_tag[], keep_proxy bool, - proxy_name text, - proxy_avatar text + + server_name text, + display_name text, + name text, + system_tag text, + + server_avatar text, + avatar text, + system_icon text ) as $$ select @@ -59,12 +66,16 @@ as $$ members.proxy_tags as proxy_tags, members.keep_proxy as keep_proxy, - -- Proxy info - case - when systems.tag is not null then (coalesce(member_guild.display_name, members.display_name, members.name) || ' ' || systems.tag) - else coalesce(member_guild.display_name, members.display_name, members.name) - end as proxy_name, - coalesce(member_guild.avatar_url, members.avatar_url, systems.avatar_url) as proxy_avatar + -- Name info + member_guild.display_name as server_name, + members.display_name as display_name, + members.name as name, + systems.tag as system_tag, + + -- Avatar info + member_guild.avatar_url as server_avatar, + members.avatar_url as avatar, + systems.avatar_url as system_icon from accounts inner join systems on systems.id = accounts.system inner join members on members.system = systems.id