Something went wrong, please try again. (Modal and buttons)

38 Views Asked by At

I have a code that processes actions in a modal window, after entering and deleting data, the code processes actions and everything works, but writes in the modal window "Something went wrong, try again". Maybe there is some way to make messages after sending in the window?

`private async Task HandleButtonInteraction(SocketInteraction interaction)
{
    if (interaction is SocketMessageComponent buttonInteraction)
    {
        if (buttonInteraction.Data.CustomId == "Поддержка")
        {
            var mb = new ModalBuilder()
                .WithTitle("Поддержка")
                .WithCustomId("support_menu")
                .AddTextInput("Краткое объяснение тикета", "support_name", placeholder: "Например: меня обозвал FenixRUS")
                .AddTextInput("Описание тикета", "support_reason", TextInputStyle.Paragraph, "Распишите, что к чему");

            await interaction.RespondWithModalAsync(mb.Build());
        }
        else if (buttonInteraction.Data.CustomId == "Верификация")
        {
            var verificationMb = new ModalBuilder()
                .WithTitle("Верификация")
                .WithCustomId("verification_menu")
                .AddTextInput("Ваш ник?", "verification_additional", TextInputStyle.Paragraph, "NeSHIZ...");

            await interaction.RespondWithModalAsync(verificationMb.Build());
        }
    }
    else if (interaction is SocketModal modalInteraction)
    {
        if (modalInteraction.Data.CustomId == "verification_menu")
        {
            await SaveVerificationAsync(modalInteraction);
        }
        else if (modalInteraction.Data.CustomId == "support_menu")
        {
            await SaveSupportTicketAsync(modalInteraction);
        }
    }
}`

Read the documentation, but I didn't see how to do it, I'm a beginner and I don't understand a lot

0

There are 0 best solutions below