From 6be9a6a89a8bd0b1a33abeb2321fbee4dfc4527a Mon Sep 17 00:00:00 2001 From: Ske Date: Mon, 29 Apr 2019 19:52:07 +0200 Subject: [PATCH] bot: only show proxy tags in list when present --- PluralKit/Bot/Commands/SystemCommands.cs | 18 +++++++++++------- PluralKit/Models.cs | 3 +++ 2 files changed, 14 insertions(+), 7 deletions(-) diff --git a/PluralKit/Bot/Commands/SystemCommands.cs b/PluralKit/Bot/Commands/SystemCommands.cs index baa29225..ba1b1cb3 100644 --- a/PluralKit/Bot/Commands/SystemCommands.cs +++ b/PluralKit/Bot/Commands/SystemCommands.cs @@ -106,7 +106,10 @@ namespace PluralKit.Bot.Commands members.OrderBy(m => m.Name).ToList(), 25, embedTitle, - (eb, ms) => eb.Description = string.Join("\n", ms.Select((m) => $"[`{m.Hid}`] **{m.Name}** *({m.Prefix ?? ""}text{m.Suffix ?? ""})*")) + (eb, ms) => eb.Description = string.Join("\n", ms.Select((m) => { + if (m.HasProxyTags) return $"[`{m.Hid}`] **{m.Name}** *({m.ProxyString})*"; + return $"[`{m.Hid}`] **{m.Name}**"; + })) ); } @@ -124,12 +127,13 @@ namespace PluralKit.Bot.Commands 10, embedTitle, (eb, ms) => { - foreach (var member in ms) { - var profile = $"**ID**: {member.Hid}"; - if (member.Pronouns != null) profile += $"\n**Pronouns**: {member.Pronouns}"; - if (member.Birthday != null) profile += $"\n**Birthdate**: {member.BirthdayString}"; - if (member.Description != null) profile += $"\n\n{member.Description}"; - eb.AddField(member.Name, profile); + foreach (var m in ms) { + var profile = $"**ID**: {m.Hid}"; + if (m.Pronouns != null) profile += $"\n**Pronouns**: {m.Pronouns}"; + if (m.Birthday != null) profile += $"\n**Birthdate**: {m.BirthdayString}"; + if (m.Prefix != null || m.Suffix != null) profile += $"\n**Proxy tags**: {m.ProxyString}"; + if (m.Description != null) profile += $"\n\n{m.Description}"; + eb.AddField(m.Name, profile); } } ); diff --git a/PluralKit/Models.cs b/PluralKit/Models.cs index 3f17c5aa..5afacfa5 100644 --- a/PluralKit/Models.cs +++ b/PluralKit/Models.cs @@ -46,5 +46,8 @@ namespace PluralKit return Birthday?.ToString("MMMM dd, yyyy"); } } + + public bool HasProxyTags => Prefix != null || Suffix != null; + public string ProxyString => $"{Prefix ?? ""}text{Suffix ?? ""}"; } } \ No newline at end of file