bot: only show proxy tags in list when present

This commit is contained in:
Ske 2019-04-29 19:52:07 +02:00
parent c359935855
commit 6be9a6a89a
2 changed files with 14 additions and 7 deletions

View File

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

View File

@ -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 ?? ""}";
}
}