Interaction Service Complex Parameters (#2155)
* Interaction Service Complex Parameters * add complex parameters * add complex parameters * fix build errors * add argument parsing * add nested complex parameter checks * add inline docs * add preferred constructor declaration * fix autocompletehandlers for complex parameters * make GetConstructor private * use flattened params in ToProps method * make DiscordType of SlashParameter nullable * add docs to Flattened parameters collection and move the GetComplexParameterCtor method * add inline docs to SlashCommandParameterBuilder.ComplexParameterFields * add check for validating required/optinal parameter order * implement change requests * return internal ParseResult as ExecuteResult Co-Authored-By: Cenk Ergen <57065323+Cenngo@users.noreply.github.com> * fix merge errors Co-authored-by: Cenk Ergen <57065323+Cenngo@users.noreply.github.com>
This commit is contained in:
@@ -13,7 +13,7 @@ namespace Discord.Interactions
|
||||
{
|
||||
Name = parameterInfo.Name,
|
||||
Description = parameterInfo.Description,
|
||||
Type = parameterInfo.DiscordOptionType,
|
||||
Type = parameterInfo.DiscordOptionType.Value,
|
||||
IsRequired = parameterInfo.IsRequired,
|
||||
Choices = parameterInfo.Choices?.Select(x => new ApplicationCommandOptionChoiceProperties
|
||||
{
|
||||
@@ -46,7 +46,7 @@ namespace Discord.Interactions
|
||||
if (commandInfo.Parameters.Count > SlashCommandBuilder.MaxOptionsCount)
|
||||
throw new InvalidOperationException($"Slash Commands cannot have more than {SlashCommandBuilder.MaxOptionsCount} command parameters");
|
||||
|
||||
props.Options = commandInfo.Parameters.Select(x => x.ToApplicationCommandOptionProps())?.ToList() ?? Optional<List<ApplicationCommandOptionProperties>>.Unspecified;
|
||||
props.Options = commandInfo.FlattenedParameters.Select(x => x.ToApplicationCommandOptionProps())?.ToList() ?? Optional<List<ApplicationCommandOptionProperties>>.Unspecified;
|
||||
|
||||
return props;
|
||||
}
|
||||
@@ -58,7 +58,7 @@ namespace Discord.Interactions
|
||||
Description = commandInfo.Description,
|
||||
Type = ApplicationCommandOptionType.SubCommand,
|
||||
IsRequired = false,
|
||||
Options = commandInfo.Parameters?.Select(x => x.ToApplicationCommandOptionProps())?.ToList()
|
||||
Options = commandInfo.FlattenedParameters?.Select(x => x.ToApplicationCommandOptionProps())?.ToList()
|
||||
};
|
||||
|
||||
public static ApplicationCommandProperties ToApplicationCommandProps(this ContextCommandInfo commandInfo)
|
||||
|
||||
Reference in New Issue
Block a user