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

Fix interactions for forms feature #538

Merged
merged 15 commits into from
Feb 19, 2022

Conversation

lukellmann
Copy link
Member

@lukellmann lukellmann commented Feb 14, 2022

  • make ModalSubmitInteraction a ComponentInteractionBehavior (it can also edit the original message if the modal was created from e.g. a button press), can only be used if message is present on the ModalSubmitInteraction
  • introduce ModalParentInteractionBehavior as a supertype of ApplicationCommandInteractionBehavior and ComponentInteraction (not ComponentInteractionBehavior) that has the modal function as a response to the interaction
  • remove note about difference in followups for ComponentInteractionBehavior, it is no longer true, visibility can be chosen for every followup individually
  • deprecate methods of ComponentInteractionBehavior and replace with new ones with more accurate names (public/ephemeral as adjective for message not acknowledgement: e.g. now acknowledgeDeferredPublicMessageUpdate instead of old acknowledgePublicDeferredMessageUpdate)
  • AutoCompleteInteractionBehavior now extends DataInteractionBehavior
  • override withStrategy to have the right return type for every interaction
  • add invokedCommandId and invokedCommandName properties to ApplicationCommandInteraction
  • add commandId and commandName to AutoCompleteInteraction
  • move MessageInteraction (the data object that is included in messages that are a response to an interaction, they are not interactions that create an event) from dev.kord.core.entity.interaction into Message as a nested class and rename it to Interaction, it was easy to confuse it with MessageCommandInteraction
  • remove UnknownApplicationCommandInteraction and UnknownComponentInteraction: if kord doesn't know about a command type or component type it can not create them in the first place so there will not be an interaction created for them, UnknownApplicationCommandInteraction also wasn't used at all
  • rename ApplicationCommandInteractionInteractionCreateEvent to ApplicationCommandInteractionCreateEvent
  • remove ephemeral from UpdateMessageInteractionResponseCreateBuilder: the visibility of an existing message can not be changed by that builder
  • consistent equals, hashCode and toString implementations for all interactions
  • some file reorderings
  • more docs

@lukellmann lukellmann marked this pull request as ready for review February 15, 2022 22:19
@lukellmann lukellmann changed the title Fix interaction mess for forms feature Fix interactions for forms feature Feb 15, 2022
# Conflicts:
#	core/src/main/kotlin/entity/interaction/ActionInteraction.kt
#	core/src/main/kotlin/entity/interaction/GlobalInteraction.kt
@lukellmann lukellmann mentioned this pull request Feb 18, 2022
@lukellmann
Copy link
Member Author

Additional changes in the commits after @HopeBaron's review:

  • fix InteractionCommand.filterOptions(), see Forms support #531 (comment)
  • add attachments to InteractionCommand
  • moved InteractionCommand and ResolvedObjects to separate files

@HopeBaron HopeBaron merged commit 9838aef into kordlib:feature/forms Feb 19, 2022
@lukellmann lukellmann deleted the feature/forms-interactions branch February 20, 2022 11:40
HopeBaron added a commit that referenced this pull request Feb 20, 2022
* Initial modals implementation

You can already receive modals via the gateway and send modals via REST

* Change the "DiscordComponent" model to multiple classes due to buttons and text inputs sharing the same field name

* Canonical order

* Use two ***DiscordComponents classes for everything

* Rename the classes because it looks better this way

* Revert core changes

* Implement text input component classes in the core module

* Fix TextInput component type deserialization

* improve the interaction tree

* More changes to the tree

* remove unresolved references

* add core events

* Apply suggestions from code review

Co-authored-by: Lukellmann <[email protected]>

* change compontents top level to ActionRowBuilder

Co-authored-by: Lukellmann <[email protected]>

* refactor files

* refactor interaction files

* refactor response files

* refactor followup messages

* add TextInputComponent list retrival property

* fix withStrategy return type

* Apply suggestions from code review

Co-authored-by: Lukellmann <[email protected]>

* rename discord modal component to DiscordTextInputComponent

* fix interaction response type

* Forms support adjustments (#534)

* return types

* sealed InteractionResponseBehavior

* ClosedRange<Int> instead of IntRange

* rename file

* GuildAutoCompleteInteraction is GuildInteraction (#535)

* required is true by default for text inputs (#537)

* rewrite a safer OptionValue implementation

* Apply code review suggestions

* Yeet out IntOptionValue

* Fix interactions for forms feature (#538)

* move MessageInteraction into Message

* interactions

* clarify why ComponentInteractionBehavior is no ModalParentInteractionBehavior

* typo

* rename ApplicationCommandInteractionInteractionCreateEvent to ApplicationCommandInteractionCreateEvent

* move ResolvedObjects

* attachments in InteractionCommand

* fix InteractionCommand.filterOptions()

* Entity in mentionables again

* move duplicate code to InteractionCommand

* ActionRowComponent docs

* rename acknowledge

* maps for components

* cleanup and consider feedback in codereview

* reintroduce CommandArgument convience methods

Co-authored-by: MrPowerGamerBR <[email protected]>
Co-authored-by: Lukellmann <[email protected]>
Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment
Labels
None yet
Projects
None yet
Development

Successfully merging this pull request may close these issues.

2 participants