mirror of
https://github.com/PluralKit/PluralKit.git
synced 2026-02-04 04:56:49 +00:00
fix(bot): use proxy name format even when tag is disabled/null
This commit is contained in:
parent
b26ca69071
commit
2555f7922c
1 changed files with 4 additions and 6 deletions
|
|
@ -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);
|
||||
}
|
||||
|
|
|
|||
Loading…
Add table
Add a link
Reference in a new issue