Closed csmir closed 1 year ago
It would be welcome that instead of trying to make an API call and checking if it throws an exception, we can check inside the interaction if it has been responded to or not. For example:
try { await interaction.SendResponseAsync(InteractionCallback.ChannelMessageWithSource(message)); } catch (RestException restException) when (restException.StatusCode == System.Net.HttpStatusCode.BadRequest) { await interaction.SendFollowupMessageAsync(message); }
could be replaced with:
if (!interaction.HasResponded) await interaction.SendResponseAsync(InteractionCallback.ChannelMessageWithSource(message)); else await interaction.SendFollowupMessageAsync(message);
Quoted from Kuba:
it's not possible to create interaction.HasResponded because everybody can use RestClient.SendInteractionResponseAsync(...)
Closing with this conclusion.
Description
It would be welcome that instead of trying to make an API call and checking if it throws an exception, we can check inside the interaction if it has been responded to or not. For example:
could be replaced with: