#How to receive a created modal?

1 messages · Page 1 of 1 (latest)

brisk sequoia
#

Hey, I'm new with the API from DSharpPlus, and I wonder how the modal works. I can't find something about that in the documentation.

chilly kettle
#

@umbral cloak DiscordClient.ModalSubmitted

umbral cloakBOT
brisk sequoia
#

whats wrong there?

#

@dapper patrol tag modal

dapper patrolBOT
brisk sequoia
#

@dapper patrol tag modal mono

dapper patrolBOT
dapper patrolBOT
#
// This applies to anywhere where you have an interaction.
// Keep in mind this isn't designed to be copy-paste, but simply to show the modal flow.

var response = new DiscordInteractionResponseBuilder();

response
  .WithTitle("Super cool modal!")
  .WithCustomId("my-modal")
  .AddComponents(new TextInputComponent(label: "Favorite food", customId: "fav-food", placeholder: "Pizza, Icecream, etc", max_length: 30)
  .AddComponents(new TextInputComponent("Why?", "why-fav", "Because it tastes good", required: false, style: TextInputStyle.Paragraph);

await interaction.CreateResponseAsync(InteractionResponseType.Modal, response);

// To get the response of this modal, simply listen to the ModalSubmitted event on the DiscordClient