From 2555f7922c8364c8727d9fa43db80efb1160a7ed Mon Sep 17 00:00:00 2001 From: Iris System Date: Tue, 12 Nov 2024 22:05:16 +1300 Subject: [PATCH] fix(bot): use proxy name format even when tag is disabled/null --- PluralKit.Core/Database/Functions/ProxyMember.cs | 10 ++++------ 1 file changed, 4 insertions(+), 6 deletions(-) diff --git a/PluralKit.Core/Database/Functions/ProxyMember.cs b/PluralKit.Core/Database/Functions/ProxyMember.cs index e95237ab..0df7cf35 100644 --- a/PluralKit.Core/Database/Functions/ProxyMember.cs +++ b/PluralKit.Core/Database/Functions/ProxyMember.cs @@ -34,18 +34,16 @@ public class ProxyMember // If not set, this formatting will be applied to the proxy name public static string DefaultFormat = "{name} {tag}"; - public static string FormatTag(string template, string tag, string name) => StringUtils.SafeFormat(template, new[] { - ("{tag}", tag), + public static string FormatTag(string template, string? tag, string name) => StringUtils.SafeFormat(template, new[] { + ("{tag}", tag ?? ""), ("{name}", name) - }); + }).Trim(); public string ProxyName(MessageContext ctx) { - // TODO: if tag is null it should still format but only if it appears in the formatting. var memberName = ServerName ?? DisplayName ?? Name; var tag = ctx.SystemGuildTag ?? ctx.SystemTag; - if (!ctx.TagEnabled || tag == null) - return memberName; + if (!ctx.TagEnabled) tag = null; return FormatTag(ctx.NameFormat ?? DefaultFormat, tag, memberName); }