Retire more IDataStore methods

This commit is contained in:
Ske
2020-06-29 14:54:11 +02:00
parent 9c1efc7886
commit 467ce78522
8 changed files with 54 additions and 152 deletions

View File

@@ -28,13 +28,15 @@ namespace PluralKit.Bot {
public async Task<DiscordEmbed> CreateSystemEmbed(DiscordClient client, PKSystem system, LookupContext ctx) {
var accounts = await _data.GetSystemAccounts(system);
public async Task<DiscordEmbed> CreateSystemEmbed(DiscordClient client, PKSystem system, LookupContext ctx)
{
await using var conn = await _db.Obtain();
// Fetch/render info for all accounts simultaneously
var accounts = await conn.GetLinkedAccounts(system.Id);
var users = await Task.WhenAll(accounts.Select(async uid => (await client.GetUserAsync(uid))?.NameAndMention() ?? $"(deleted account {uid})"));
var memberCount = await _data.GetSystemMemberCount(system.Id, false);
var memberCount = await conn.GetSystemMemberCount(system.Id, PrivacyLevel.Public);
var eb = new DiscordEmbedBuilder()
.WithColor(DiscordUtils.Gray)
.WithTitle(system.Name ?? null)