feat(bot): -all flag to add/remove all members from group

This commit is contained in:
Petal Ladenson 2024-10-03 02:30:39 -06:00 committed by GitHub
parent 4bd4407771
commit 93264cbf20
No known key found for this signature in database
GPG key ID: B5690EEEBB952194
2 changed files with 14 additions and 1 deletions

View file

@ -86,10 +86,22 @@ public class GroupMember
{
ctx.CheckOwnGroup(target);
var members = (await ctx.ParseMemberList(ctx.System.Id))
List<MemberId> members;
if (ctx.MatchFlag("all", "a"))
{
members = (await ctx.Database.Execute(conn => conn.QueryMemberList(target.System,
new DatabaseViewsExt.ListQueryOptions { })))
.Select(m => m.Id)
.Distinct()
.ToList();
}
else
{
members = (await ctx.ParseMemberList(ctx.System.Id))
.Select(m => m.Id)
.Distinct()
.ToList();
}
var existingMembersInGroup = (await ctx.Database.Execute(conn => conn.QueryMemberList(target.System,
new DatabaseViewsExt.ListQueryOptions { GroupFilter = target.Id })))

View file

@ -77,6 +77,7 @@ You cannot look up private members or groups of another system.
|pk;system frontpercent|-flat||Show "flat" frontpercent - percentages add up to 100%|
|pk;group \<group> frontpercent|-fronters-only|-fo|Show a group's frontpercent without the "no fronter" entry|
|pk;group \<group> frontpercent|-flat||Show "flat" frontpercent - percentages add up to 100%|
|pk;group \<group> \<add/remove>|-all|-a|Add or remove all members from a group.|
|pk;edit|-append|-a|Append the new content to the old message instead of overwriting it|
|pk;edit|-prepend|-p|Prepend the new content to the old message instead of overwriting it|
|pk;edit|-nospace|-ns|Append/prepend without adding a space|