private async Task HandleButtonInteraction(SocketInteraction interaction)
{
if (interaction is SocketMessageComponent buttonInteraction)
{
if (buttonInteraction.Data.CustomId == "Поддержка")
{
var userWhoClicked = buttonInteraction.User;
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 userWhoClicked = buttonInteraction.User;
var verificationMb = new ModalBuilder()
.WithTitle("Верификация")
.WithCustomId("verification_menu")
.AddTextInput("Ваш ник?", "verification_additional", TextInputStyle.Paragraph, "NeSHIZ...");
var verificationResponse = await interaction.RespondWithModalAsync(verificationMb.Build());
var verificationAdditional = verificationResponse.GetTextInput("verification_additional") as string;
SaveVerificationToDatabase(userWhoClicked.Username, verificationAdditional);
}
}
}
I haven't tried to do anything because I don't have the knowledge and I haven't found a similar case on the Internet. Although I found articles parsing the error, but it didn't help.
This line is the problem
var verificationResponse = await interaction.RespondWithModalAsync(verificationMb.Build());
SocketMessageComponent.RespondWithModalAsyncindeed returns aTaskwithout a value.https://discordnet.dev/api/Discord.WebSocket.SocketMessageComponent.html
You're going to need another interaction clause like