implement random commands, dont keep the subcommands only the flags

This commit is contained in:
dusk 2025-09-26 23:56:49 +00:00
parent c00ff2f371
commit c92c3f84f0
No known key found for this signature in database
13 changed files with 82 additions and 24 deletions

View file

@ -147,13 +147,9 @@ public static class ContextEntityArgumentsExt
return member;
}
public static async Task<PKGroup> PeekGroup(this Context ctx, SystemId? restrictToSystem = null)
public static async Task<PKGroup> ParseGroup(this Context ctx, string input, bool byId, SystemId? restrictToSystem = null)
{
var input = ctx.PeekArgument();
// see PeekMember for an explanation of the logic used here
if (ctx.System != null && !ctx.MatchFlag("id", "by-id"))
if (ctx.System != null && !byId)
{
if (await ctx.Repository.GetGroupByName(ctx.System.Id, input) is { } byName)
return byName;
@ -170,6 +166,11 @@ public static class ContextEntityArgumentsExt
return null;
}
public static async Task<PKGroup> PeekGroup(this Context ctx, SystemId? restrictToSystem = null)
{
throw new NotImplementedException();
}
public static async Task<PKGroup> MatchGroup(this Context ctx, SystemId? restrictToSystem = null)
{
var group = await ctx.PeekGroup(restrictToSystem);