Skip to content
New issue

Have a question about this project? Sign up for a free GitHub account to open an issue and contact its maintainers and the community.

By clicking “Sign up for GitHub”, you agree to our terms of service and privacy statement. We’ll occasionally send you account related emails.

Already on GitHub? Sign in to your account

Interaction Service Complex Parameters #2155

Merged
merged 2 commits into from Mar 2, 2022
Merged

Conversation

quinchs
Copy link
Member

@quinchs quinchs commented Mar 2, 2022

Summary

This PR adds a new feature called complex parameters to the Interaction Service. This allows users to create slash command options using an objects constructor. Also allowing complex objects to be created which cannot be infered from only one input value.
Constructor methods support every attribute type that can be used with the regular slash commands ([Autocomplete], [Summary] etc. ).
Preferred constructor of a Type can be specified either by passing a Type[] to the ComplexParameterAttribute or tagging a type constructor with the ComplexParameterCtorAttribute. If nothing is specified, the InteractionService defaults to the only public constructor of the type.
TypeConverter pattern is used to parse the constructor methods objects.

This PR is ready to be merged but it changes the way SlashCommandParameters are parsed on execution, so i dont think this change should be included in the D-Net v3 roll out.

image
image
image

* 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>
@quinchs quinchs merged commit 9ba64f6 into dev Mar 2, 2022
@quinchs quinchs deleted the feature/complex-parameters branch March 2, 2022 23:23
Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment
Projects
None yet
Development

Successfully merging this pull request may close these issues.

None yet

1 participant