#Modal
1 messages · Page 1 of 1 (latest)
By using custom IDs :P
Set it with ModalBuilder
Make sure it's the same in the ModalInteractionAttribute's parameter
It doesn't work -_-
[ComponentInteraction("...", runMode: RunMode.Async)]
public async Task HnadleButtonInteractionAsync()
{
TextInputBuilder notificationTextInput = new TextInputBuilder()
.WithPlaceholder("Webhook Title")
.WithLabel("Enter the webhook title")
.WithValue("Title")
.WithMaxLength(80)
.WithRequired(false)
.WithStyle(TextInputStyle.Short)
.WithCustomId("WebhookBuilder_TextInput");
Modal notificationModal = new ModalBuilder()
.WithTitle("Webhook Title")
.WithCustomId("WebhookBuilder_Title_Modal")
.AddTextInput(notificationTextInput)
.Build();
await RespondWithModalAsync(notificationModal).ConfigureAwait(false);
}
[ModalInteraction("WebhookBuilder_Title_Modal", runMode: RunMode.Async)]
public async Task HandleModalInteractionAsync(string title)
{
await RespondAsync("Test").ConfigureAwait(false);
}
Try not using uppercases
If still not working, make sure you handle ModalSubimtted if you're not using InteractionCreated event
It works fine with ModalSubmittedevent
Why shouldn't it work with ModalInteraction?

@late cipher
sry for ping
#support-dnet message
Continuation of the previous Generic Modal writeup. This one uses typeconverters.
// This code will handle all current layouts possible with modals, in 25 lines of code.
public class GenericInputModal<T1> : IModal
{
public string Title => string.Empty;
[ModalTextInput("first")]
public T1 First {get;set;}
}
public class GenericInputModal<T1, T2> : GenericInputModal<T1>
{
[ModalTextInput("second")]
public T2 Second {get;set;}
}
public class GenericInputModal<T1, T2, T3> : GenericInputModal<T1,T2>
{
[ModalTextInput("third")]
public T3 Third {get;set;}
}
public class GenericInputModal<T1, T2, T3, T4> : GenericInputModal<T1, T2, T3>
{
[ModalTextInput("fourth")]
public T4 Fourth {get;set;}
}
public class GenericInputModal<T1, T2, T3, T4, T5> : GenericInputModal<T1, T2, T3, T4>
{
[ModalTextInput("fifth")]
public T5 Fifth {get;set;}
}
var ModalBuilderA = new ModalBuilder();
ModalBuilderA.WithTitle("Modal A");
ModalBuilderA.WithCustomId("modal-a");
ModalBuilderA.AddTe...
@late cipher from #support-dnet in Discord.Net
I've followed this example and the modal appears but it's not able to be submitted
My project supports button interactions, slash commands, etc. Am I perhaps missing something that isn't in the intro ?
is the handler for one in a class with Group attribute?
Yes, it's in the same class as the command
Oh I did see you comment something about gruops in another help request...
You won't believe it
yup
you need to set a delimiter char first
in the InteractionServiceConfig
*one is passed into interaction service ctor
and then
let's say
- the delimiter is
| - you have a group module called
module_name - you have a
ModalInteraction("custom_id")
set the custom id of the modal you respond with tomodule_name|custom_id
I put '.', is that a dangerous one to use ?