better parameters handling, implement import export

This commit is contained in:
dusk 2025-10-03 15:50:54 +00:00
parent e4f38c76a9
commit 5198f7d83b
No known key found for this signature in database
19 changed files with 250 additions and 174 deletions

View file

@ -20,7 +20,7 @@ public static class ContextParametersExt
);
}
public static async Task<List<PKMember>> ParamResolveMembers(this Context ctx, string param_name)
public static async Task<List<PKMember>?> ParamResolveMembers(this Context ctx, string param_name)
{
return await ctx.Parameters.ResolveParameter(
ctx, param_name,
@ -36,7 +36,7 @@ public static class ContextParametersExt
);
}
public static async Task<List<PKGroup>> ParamResolveGroups(this Context ctx, string param_name)
public static async Task<List<PKGroup>?> ParamResolveGroups(this Context ctx, string param_name)
{
return await ctx.Parameters.ResolveParameter(
ctx, param_name,

View file

@ -126,6 +126,8 @@ public class Parameters
return new Parameter.ChannelRef(await ctx.Rest.GetChannelOrNull(channelId) ?? throw new PKError($"Channel {channelId} not found"));
case uniffi.commands.Parameter.GuildRef(var guildId):
return new Parameter.GuildRef(await ctx.Rest.GetGuildOrNull(guildId) ?? throw new PKError($"Guild {guildId} not found"));
case uniffi.commands.Parameter.Null:
return null;
}
return null;
}