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] Update modal's DeferAsync impl #2722

Merged
merged 2 commits into from
Aug 10, 2023

Conversation

Misha-133
Copy link
Member

Currently defer on modals responds with InteractionResponseType.DeferredUpdateMessage response type, while leaving no way of responding with InteractionResponseType.DeferredChannelMessageWithSource - basically making it impossible to defer a modal sent in response to a slash command interaction.
This PR adds the DeferLoadingAsync method to IModalInteraction. In a similar to IComponentInteraction way - it responds with DeferredChannelMessageWithSource type.

Changes

  • add DeferLoadingAsync to IModalInteraction and its inherited types
  • update Defer(Async) to use DeferredChannelMessageWithSource if the IModalInteraction.Message is null (= interaction that triggered the modal was not a component interaction)

Warning

  • This PR changes the behavior of RestModal.Defer to respond with DeferredUpdateMessage type to equalize behavior with the SocketModal.DeferAsync
  • In addition to the previous change - if the modal was sent in a response to a non component interaction - the Defer(Async) responds with DeferredChannelMessageWithSource type instead of DeferredUpdateMessage

fixes #2624

@Misha-133 Misha-133 merged commit 5f580f6 into discord-net:dev Aug 10, 2023
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.

[Bug]: DeferAsync on SocketModal does not show a loading state to the user
2 participants