mirror of
https://github.com/PluralKit/PluralKit.git
synced 2026-02-10 15:57:53 +00:00
Add group member list command
This commit is contained in:
parent
0f4c40b344
commit
8a28d836c7
4 changed files with 35 additions and 3 deletions
|
|
@ -5,6 +5,8 @@ using System.Threading.Tasks;
|
|||
|
||||
using DSharpPlus.Entities;
|
||||
|
||||
using NodaTime;
|
||||
|
||||
using PluralKit.Core;
|
||||
|
||||
namespace PluralKit.Bot
|
||||
|
|
@ -176,6 +178,26 @@ namespace PluralKit.Bot
|
|||
}
|
||||
}
|
||||
|
||||
public async Task ListGroupMembers(Context ctx, PKGroup target)
|
||||
{
|
||||
await using var conn = await _db.Obtain();
|
||||
var targetSystem = await GetGroupSystem(ctx, target, conn);
|
||||
ctx.CheckSystemPrivacy(targetSystem, targetSystem.MemberListPrivacy);
|
||||
|
||||
var opts = ctx.ParseMemberListOptions(ctx.LookupContextFor(target.System));
|
||||
opts.GroupFilter = target.Id;
|
||||
|
||||
var title = new StringBuilder($"Members of {target.Name} (`{target.Hid}`) in ");
|
||||
if (targetSystem.Name != null)
|
||||
title.Append($"{targetSystem.Name} (`{targetSystem.Hid}`)");
|
||||
else
|
||||
title.Append($"`{targetSystem.Hid}`");
|
||||
if (opts.Search != null)
|
||||
title.Append($" matching **{opts.Search}**");
|
||||
|
||||
await ctx.RenderMemberList(ctx.LookupContextFor(target.System), _db, target.System, title.ToString(), opts);
|
||||
}
|
||||
|
||||
public enum AddRemoveOperation
|
||||
{
|
||||
Add,
|
||||
|
|
|
|||
Loading…
Add table
Add a link
Reference in a new issue