mirror of
https://github.com/PluralKit/PluralKit.git
synced 2026-02-08 14:57:54 +00:00
implement parse list options and related commands
This commit is contained in:
parent
3e7898e5cc
commit
95fc7e9f60
18 changed files with 367 additions and 199 deletions
|
|
@ -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,
|
||||
|
|
|
|||
Loading…
Add table
Add a link
Reference in a new issue