Show member count on group card

This commit is contained in:
Ske
2020-07-18 13:19:53 +02:00
parent 0d04be6540
commit ec9ee5c794
2 changed files with 19 additions and 1 deletions

View File

@@ -31,7 +31,7 @@ namespace PluralKit.Bot
await using var conn = await _db.Obtain();
var newGroup = await conn.CreateGroup(ctx.System.Id, groupName);
await ctx.Reply($"{Emojis.Success} Group \"**{groupName}**\" (`{newGroup.Hid}`) registered!\nYou can now start adding members to the group:\n- **pk;group {newGroup.Hid} add <members...>**");
await ctx.Reply($"{Emojis.Success} Group \"**{groupName}**\" (`{newGroup.Hid}`) registered!\nYou can now start adding members to the group like this:\n> **pk;group `{newGroup.Hid}` add `member1` `member2...`**");
}
public async Task RenameGroup(Context ctx, PKGroup target)
@@ -133,6 +133,7 @@ namespace PluralKit.Bot
await using var conn = await _db.Obtain();
var system = await GetGroupSystem(ctx, target, conn);
var memberCount = await conn.QueryGroupMemberCount(target.Id, PrivacyLevel.Public);
var nameField = target.Name;
if (system.Name != null)
@@ -142,6 +143,11 @@ namespace PluralKit.Bot
.WithAuthor(nameField)
.WithFooter($"System ID: {system.Hid} | Group ID: {target.Hid} | Created on {target.Created.FormatZoned(system)}");
if (memberCount == 0)
eb.AddField("Members (0)", $"Add one with `pk;group {target.Hid} add <member>`!", true);
else
eb.AddField($"Members ({memberCount})", $"(see `pk;group {target.Hid} list`)", true);
if (target.Description != null)
eb.AddField("Description", target.Description);