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); }