@@ -18,7 +18,7 @@ namespace Discord.API | |||
// 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 Optional<MessageFlags> Flags { get; set; } | |||
[JsonProperty("components")] | |||
public Optional<API.ActionRowComponent[]> Components { get; set; } | |||
@@ -28,7 +28,7 @@ namespace Discord.API.Rest | |||
public Optional<AllowedMentions> AllowedMentions { get; set; } | |||
[JsonProperty("flags")] | |||
public Optional<int> Flags { get; set; } | |||
public Optional<MessageFlags> Flags { get; set; } | |||
[JsonProperty("components")] | |||
public Optional<API.ActionRowComponent[]> Components { get; set; } | |||
@@ -3628,14 +3628,8 @@ | |||
<member name="M:Discord.WebSocket.SocketMessageComponent.FollowupAsync(System.String,Discord.Embed[],System.Boolean,System.Boolean,Discord.AllowedMentions,Discord.RequestOptions,Discord.MessageComponent,Discord.Embed)"> | |||
<inheritdoc/> | |||
</member> | |||
<member name="M:Discord.WebSocket.SocketMessageComponent.DeferAsync(Discord.RequestOptions)"> | |||
<summary> | |||
Acknowledges this interaction with the <see cref="F:Discord.InteractionResponseType.DeferredUpdateMessage"/>. | |||
</summary> | |||
<param name="options">The request options for this async request.</param> | |||
<returns> | |||
A task that represents the asynchronous operation of acknowledging the interaction. | |||
</returns> | |||
<member name="M:Discord.WebSocket.SocketMessageComponent.DeferAsync(System.Boolean,Discord.RequestOptions)"> | |||
<inheritdoc/> | |||
</member> | |||
<member name="T:Discord.WebSocket.SocketMessageComponentData"> | |||
<summary> | |||
@@ -3747,13 +3741,8 @@ | |||
<member name="M:Discord.WebSocket.SocketSlashCommand.FollowupAsync(System.String,Discord.Embed[],System.Boolean,System.Boolean,Discord.AllowedMentions,Discord.RequestOptions,Discord.MessageComponent,Discord.Embed)"> | |||
<inheritdoc/> | |||
</member> | |||
<member name="M:Discord.WebSocket.SocketSlashCommand.DeferAsync(Discord.RequestOptions)"> | |||
<summary> | |||
Acknowledges this interaction with the <see cref="F:Discord.InteractionResponseType.DeferredChannelMessageWithSource"/>. | |||
</summary> | |||
<returns> | |||
A task that represents the asynchronous operation of acknowledging the interaction. | |||
</returns> | |||
<member name="M:Discord.WebSocket.SocketSlashCommand.DeferAsync(System.Boolean,Discord.RequestOptions)"> | |||
<inheritdoc/> | |||
</member> | |||
<member name="T:Discord.WebSocket.SocketSlashCommandData"> | |||
<summary> | |||
@@ -3888,10 +3877,12 @@ | |||
A task that represents the asynchronous operation of acknowledging the interaction. | |||
</returns> | |||
</member> | |||
<member name="M:Discord.WebSocket.SocketInteraction.DeferAsync(Discord.RequestOptions)"> | |||
<member name="M:Discord.WebSocket.SocketInteraction.DeferAsync(System.Boolean,Discord.RequestOptions)"> | |||
<summary> | |||
Acknowledges this interaction. | |||
</summary> | |||
<param name="ephemeral"><see langword="true"/> to send this message ephemerally, otherwise <see langword="false"/>.</param> | |||
<param name="options">The request options for this async request.</param> | |||
<returns> | |||
A task that represents the asynchronous operation of acknowledging the interaction. | |||
</returns> | |||
@@ -123,7 +123,7 @@ namespace Discord.WebSocket | |||
}; | |||
if (ephemeral) | |||
response.Data.Value.Flags = 64; | |||
response.Data.Value.Flags = MessageFlags.Ephemeral; | |||
await InteractionHelper.SendInteractionResponse(this.Discord, response, this.Id, Token, options); | |||
} | |||
@@ -180,7 +180,7 @@ namespace Discord.WebSocket | |||
Components = args.Components.IsSpecified | |||
? args.Components.Value?.Components.Select(x => new API.ActionRowComponent(x)).ToArray() | |||
: Optional<API.ActionRowComponent[]>.Unspecified, | |||
Flags = args.Flags.IsSpecified ? (int?)args.Flags.Value ?? Optional<int>.Unspecified : Optional<int>.Unspecified | |||
Flags = args.Flags.IsSpecified ? args.Flags.Value ?? Optional<MessageFlags>.Unspecified : Optional<MessageFlags>.Unspecified | |||
} | |||
}; | |||
@@ -217,23 +217,19 @@ namespace Discord.WebSocket | |||
}; | |||
if (ephemeral) | |||
args.Flags = 64; | |||
args.Flags = MessageFlags.Ephemeral; | |||
return await InteractionHelper.SendFollowupAsync(Discord.Rest, args, Token, Channel, options); | |||
} | |||
/// <summary> | |||
/// Acknowledges this interaction with the <see cref="InteractionResponseType.DeferredUpdateMessage"/>. | |||
/// </summary> | |||
/// <param name="options">The request options for this async request.</param> | |||
/// <returns> | |||
/// A task that represents the asynchronous operation of acknowledging the interaction. | |||
/// </returns> | |||
public override Task DeferAsync(RequestOptions options = null) | |||
/// <inheritdoc/> | |||
public override Task DeferAsync(bool ephemeral = false, RequestOptions options = null) | |||
{ | |||
var response = new API.InteractionResponse() | |||
{ | |||
Type = InteractionResponseType.DeferredUpdateMessage, | |||
Data = ephemeral ? new API.InteractionCallbackData() { Flags = MessageFlags.Ephemeral } : Optional<API.InteractionCallbackData>.Unspecified | |||
}; | |||
return Discord.Rest.ApiClient.CreateInteractionResponse(response, this.Id, this.Token, options); | |||
@@ -106,7 +106,7 @@ namespace Discord.WebSocket | |||
}; | |||
if (ephemeral) | |||
response.Data.Value.Flags = 64; | |||
response.Data.Value.Flags = MessageFlags.Ephemeral; | |||
await InteractionHelper.SendInteractionResponse(this.Discord, response, this.Id, Token, options); | |||
} | |||
@@ -141,22 +141,18 @@ namespace Discord.WebSocket | |||
}; | |||
if (ephemeral) | |||
args.Flags = 64; | |||
args.Flags = MessageFlags.Ephemeral; | |||
return await InteractionHelper.SendFollowupAsync(Discord.Rest, args, Token, Channel, options); | |||
} | |||
/// <summary> | |||
/// Acknowledges this interaction with the <see cref="InteractionResponseType.DeferredChannelMessageWithSource"/>. | |||
/// </summary> | |||
/// <returns> | |||
/// A task that represents the asynchronous operation of acknowledging the interaction. | |||
/// </returns> | |||
public override Task DeferAsync(RequestOptions options = null) | |||
/// <inheritdoc/> | |||
public override Task DeferAsync(bool ephemeral = false, RequestOptions options = null) | |||
{ | |||
var response = new API.InteractionResponse | |||
{ | |||
Type = InteractionResponseType.DeferredChannelMessageWithSource, | |||
Data = ephemeral ? new API.InteractionCallbackData() { Flags = MessageFlags.Ephemeral } : Optional<API.InteractionCallbackData>.Unspecified | |||
}; | |||
return Discord.Rest.ApiClient.CreateInteractionResponse(response, this.Id, this.Token, options); | |||
@@ -156,15 +156,17 @@ namespace Discord.WebSocket | |||
/// A task that represents the asynchronous operation of acknowledging the interaction. | |||
/// </returns> | |||
[Obsolete("This method deprecated, please use DeferAsync instead")] | |||
public Task AcknowledgeAsync(RequestOptions options = null) => DeferAsync(options); | |||
public Task AcknowledgeAsync(RequestOptions options = null) => DeferAsync(options: options); | |||
/// <summary> | |||
/// Acknowledges this interaction. | |||
/// </summary> | |||
/// <param name="ephemeral"><see langword="true"/> to send this message ephemerally, otherwise <see langword="false"/>.</param> | |||
/// <param name="options">The request options for this async request.</param> | |||
/// <returns> | |||
/// A task that represents the asynchronous operation of acknowledging the interaction. | |||
/// </returns> | |||
public abstract Task DeferAsync(RequestOptions options = null); | |||
public abstract Task DeferAsync(bool ephemeral = false, RequestOptions options = null); | |||
private bool CheckToken() | |||
{ | |||