Fix other users being able to answer interview questions in selectors and buttons

This commit is contained in:
Toastie 2025-02-04 20:38:34 +13:00
parent 9d30a2d415
commit be44de1eb3
Signed by: toastie_t0ast
GPG key ID: 0861BE54AD481DC7

View file

@ -70,6 +70,26 @@ public static class Interviewer
return;
}
if (!Database.TryGetOpenTicket(interaction.Channel.Id, out Database.Ticket ticket))
{
await interaction.CreateResponseAsync(DiscordInteractionResponseType.ChannelMessageWithSource, new DiscordInteractionResponseBuilder()
.AddEmbed(new DiscordEmbedBuilder()
.WithColor(DiscordColor.Red)
.WithDescription("Error: This doesn't seem to be in a ticket channel."))
.AsEphemeral());
return;
}
if (interaction.User.Id != ticket.creatorID)
{
await interaction.CreateResponseAsync(DiscordInteractionResponseType.ChannelMessageWithSource, new DiscordInteractionResponseBuilder()
.AddEmbed(new DiscordEmbedBuilder()
.WithColor(DiscordColor.Red)
.WithDescription("Only the user who opened this ticket can answer interview questions."))
.AsEphemeral());
return;
}
// Ignore if option was deselected.
if (interaction.Data.ComponentType is not DiscordComponentType.Button && interaction.Data.Values.Length == 0)
{