implement parse list options and related commands

This commit is contained in:
dusk 2025-09-30 18:45:35 +00:00
parent 3e7898e5cc
commit 95fc7e9f60
No known key found for this signature in database
18 changed files with 367 additions and 199 deletions

View file

@ -8,16 +8,20 @@ namespace PluralKit.Bot;
public class SystemList
{
public async Task MemberList(Context ctx, PKSystem target)
public async Task MemberList(Context ctx, PKSystem target, string? query, IHasListOptions flags)
{
ctx.CheckSystem(target);
if (target == null) throw Errors.NoSystemError(ctx.DefaultPrefix);
ctx.CheckSystemPrivacy(target.Id, target.MemberListPrivacy);
var opts = flags.GetListOptions(ctx, target.Id);
opts.Search = query;
// explanation of privacy lookup here:
// - ParseListOptions checks list access privacy and sets the privacy filter (which members show up in list)
// - RenderMemberList checks the indivual privacy for each member (NameFor, etc)
// the own system is always allowed to look up their list
var opts = ctx.ParseListOptions(ctx.DirectLookupContextFor(target.Id), ctx.LookupContextFor(target.Id));
await ctx.RenderMemberList(
ctx.LookupContextFor(target.Id),
target.Id,