mirror of
https://github.com/PluralKit/PluralKit.git
synced 2026-02-04 13:06:50 +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
|
|
@ -14,7 +14,11 @@ namespace PluralKit.Core
|
|||
|
||||
public static Task<IEnumerable<ListedMember>> QueryMemberList(this IPKConnection conn, SystemId system, MemberListQueryOptions opts)
|
||||
{
|
||||
StringBuilder query = new StringBuilder("select * from member_list where system = @system");
|
||||
StringBuilder query;
|
||||
if (opts.GroupFilter == null)
|
||||
query = new StringBuilder("select * from member_list where system = @system");
|
||||
else
|
||||
query = new StringBuilder("select member_list.* from group_members inner join member_list on member_list.id = group_members.member_id where group_id = @groupFilter");
|
||||
|
||||
if (opts.PrivacyFilter != null)
|
||||
query.Append($" and member_visibility = {(int) opts.PrivacyFilter}");
|
||||
|
|
@ -35,7 +39,7 @@ namespace PluralKit.Core
|
|||
query.Append(")");
|
||||
}
|
||||
|
||||
return conn.QueryAsync<ListedMember>(query.ToString(), new {system, filter = opts.Search});
|
||||
return conn.QueryAsync<ListedMember>(query.ToString(), new {system, filter = opts.Search, groupFilter = opts.GroupFilter});
|
||||
}
|
||||
|
||||
public struct MemberListQueryOptions
|
||||
|
|
@ -44,6 +48,7 @@ namespace PluralKit.Core
|
|||
public string? Search;
|
||||
public bool SearchDescription;
|
||||
public LookupContext Context;
|
||||
public GroupId? GroupFilter;
|
||||
}
|
||||
}
|
||||
}
|
||||
Loading…
Add table
Add a link
Reference in a new issue