Discord.Net icon indicating copy to clipboard operation
Discord.Net copied to clipboard

Modals Improvements

Open Cenngo opened this issue 2 years ago • 0 comments

Moves ModalUtils class to public, adds a ConfirmAsync overload to be used with SocketInteractions and SendModalAsync() method to InteractionUtils class for prompting a modal and asynchronously awaiting the user response.

{
     ...
     TestModal modal = await Context.Interaction.SendModalAsync<TestModal>(timeout: TimeSpan.FromMinutes(1));
     ...
}

Tho this may seem like a easy and foolproof way of getting user inputs inside a command execution body it should be noted that Discord doesn't send a gateway event for when a user dismisses a modal without responding. Which will result in this method to await until it times out, hogging resources needlessly in the meantime.

Cenngo avatar Apr 10 '22 16:04 Cenngo