Add fronter info to system card

This commit is contained in:
Ske 2019-07-18 14:05:02 +02:00
parent 1ad01703b0
commit dfbb5cd2d6

View File

@ -29,7 +29,6 @@ namespace PluralKit.Bot {
var users = await Task.WhenAll(accounts.Select(async uid => (await _client.GetUserAsync(uid))?.NameAndMention() ?? $"(deleted account {uid})"));
var memberCount = await _members.MemberCount(system);
var eb = new EmbedBuilder()
.WithColor(Color.Blue)
.WithTitle(system.Name ?? null)
@ -37,10 +36,19 @@ namespace PluralKit.Bot {
.WithThumbnailUrl(system.AvatarUrl ?? null)
.WithFooter($"System ID: {system.Hid}");
var latestSwitch = await _switches.GetLatestSwitch(system);
if (latestSwitch != null)
{
var switchMembers = (await _switches.GetSwitchMembers(latestSwitch)).ToList();
if (switchMembers.Count > 0)
eb.AddField("Fronter".ToQuantity(switchMembers.Count(), ShowQuantityAs.None),
string.Join(", ", switchMembers.Select(m => m.Name)));
}
if (system.Tag != null) eb.AddField("Tag", system.Tag);
eb.AddField("Linked accounts", string.Join(", ", users));
eb.AddField($"Members ({memberCount})", $"(see `pk;system {system.Hid} list` or `pk;system {system.Hid} list full`)");
// TODO: fronter
return eb.Build();
}