/// The response type for an <see cref="IDiscordInteraction"/>.
/// </summary>
/// <remarks>
/// After receiving an interaction, you must respond to acknowledge it. You can choose to respond with a message immediately using <see cref="ChannelMessageWithSource"/>
/// or you can choose to send a deferred response with <see cref="ACKWithSource"/>. If choosing a deferred response, the user will see a loading state for the interaction,
/// and you'll have up to 15 minutes to edit the original deferred response using Edit Original Interaction Response.
/// You can read more about Response types <see href="https://discord.com/developers/docs/interactions/slash-commands#interaction-response">Here</see>
/// </remarks>
public enum InteractionResponseType : byte
{
/// <summary>
@@ -16,24 +22,26 @@ namespace Discord
/// </summary>
Pong = 1,
[Obsolete("This response type has been depricated by discord. Either use ChannelMessageWithSource or ACKWithSource", true)]
/// <summary>
/// ACK a command without sending a message, eating the user's input.
/// </summary>
Acknowledge = 2,
[Obsolete("This response type has been depricated by discord. Either use ChannelMessageWithSource or ACKWithSource", true)]
/// <summary>
/// Respond with a message, eating the user's input.
/// Respond with a message, showing the user's input.
/// </summary>
ChannelMessage = 3,
/// <summary>
/// Respond with a message, showing the user's input.
/// Respond to an interaction with a message.
/// </summary>
ChannelMessageWithSource = 4,
/// <summary>
/// ACK a command without sending a message, showing the user's input.
/// ACK an interaction and edit a response later, the user sees a loading state.
public Optional<AllowedMentions> AllowedMentions { get; set; }
// New flags prop. this make the response "ephemeral". see https://discord.com/developers/docs/interactions/slash-commands#interaction-response-interactionapplicationcommandcallbackdata
[JsonProperty("flags")]
public Optional<int> Flags { get; set; }
public InteractionApplicationCommandCallbackData() { }
public InteractionApplicationCommandCallbackData(string text)
/// <param name="text">The text of the message to be sent.</param>
/// <param name="isTTS"><see langword="true"/> if the message should be read out by a text-to-speech reader, otherwise <see langword="false"/>.</param>
/// <param name="embed">A <see cref="Embed"/> to send with this response.</param>
/// <param name="Type">The type of response to this Interaction.</param>
/// <param name="type">The type of response to this Interaction.</param>
/// <param name="ephemeral"><see langword="true"/> if the response should be hidden to everyone besides the invoker of the command, otherwise <see langword="false"/>.</param>
/// <param name="allowedMentions">The allowed mentions for this response.</param>
/// <param name="options">The request options for this response.</param>
/// <returns>
@@ -113,16 +114,17 @@ namespace Discord.WebSocket
/// <exception cref="ArgumentOutOfRangeException">Message content is too long, length must be less or equal to <see cref="DiscordConfig.MaxMessageSize"/>.</exception>
/// <exception cref="InvalidOperationException">The parameters provided were invalid or the token was invalid.</exception>
public async Task<IMessage> RespondAsync(string text = null, bool isTTS = false, Embed embed = null, InteractionResponseType Type = InteractionResponseType.ChannelMessageWithSource, AllowedMentions allowedMentions = null, RequestOptions options = null)
public async Task<IMessage> RespondAsync(string text = null, bool isTTS = false, Embed embed = null, InteractionResponseType type = InteractionResponseType.ChannelMessageWithSource,
/// <param name="isTTS"><see langword="true"/> if the message should be read out by a text-to-speech reader, otherwise <see langword="false"/>.</param>
/// <param name="embed">A <see cref="Embed"/> to send with this response.</param>
/// <param name="Type">The type of response to this Interaction.</param>
/// /// <param name="ephemeral"><see langword="true"/> if the response should be hidden to everyone besides the invoker of the command, otherwise <see langword="false"/>.</param>
/// <param name="allowedMentions">The allowed mentions for this response.</param>
/// <param name="options">The request options for this response.</param>
/// <returns>
/// The sent message.
/// </returns>
public async Task<IMessage> FollowupAsync(string text = null, bool isTTS = false, Embed embed = null, InteractionResponseType Type = InteractionResponseType.ChannelMessageWithSource,
public async Task<IMessage> FollowupAsync(string text = null, bool isTTS = false, Embed embed = null, bool ephemeral = false,
InteractionResponseType Type = InteractionResponseType.ChannelMessageWithSource,
if (Type == InteractionResponseType.ACKWithSource || Type == InteractionResponseType.ACKWithSource || Type == InteractionResponseType.Pong)
if (Type == InteractionResponseType.DeferredChannelMessageWithSource || Type == InteractionResponseType.DeferredChannelMessageWithSource || Type == InteractionResponseType.Pong)
throw new InvalidOperationException($"Cannot use {Type} on a send message function");