Fixed permission overwrites using incorrect values for targets Fixed invalid form data for responding Fixed ambiguous method for responding/folloup Added new ApplicationCommandPermissionTarget for slash command permissionspull/1923/head
@@ -7407,7 +7407,7 @@ | |||||
<see langword="true"/> to allow, otherwise <see langword="false"/>. | <see langword="true"/> to allow, otherwise <see langword="false"/>. | ||||
</summary> | </summary> | ||||
</member> | </member> | ||||
<member name="M:Discord.ApplicationCommandPermission.#ctor(System.UInt64,Discord.PermissionTarget,System.Boolean)"> | |||||
<member name="M:Discord.ApplicationCommandPermission.#ctor(System.UInt64,Discord.ApplicationCommandPermissionTarget,System.Boolean)"> | |||||
<summary> | <summary> | ||||
Creates a new <see cref="T:Discord.ApplicationCommandPermission"/>. | Creates a new <see cref="T:Discord.ApplicationCommandPermission"/>. | ||||
</summary> | </summary> | ||||
@@ -7417,18 +7417,33 @@ | |||||
</member> | </member> | ||||
<member name="M:Discord.ApplicationCommandPermission.#ctor(Discord.IUser,System.Boolean)"> | <member name="M:Discord.ApplicationCommandPermission.#ctor(Discord.IUser,System.Boolean)"> | ||||
<summary> | <summary> | ||||
Creates a new <see cref="T:Discord.ApplicationCommandPermission"/> targeting <see cref="F:Discord.PermissionTarget.User"/>. | |||||
Creates a new <see cref="T:Discord.ApplicationCommandPermission"/> targeting <see cref="F:Discord.ApplicationCommandPermissionTarget.User"/>. | |||||
</summary> | </summary> | ||||
<param name="target">The user you want to target this permission value for.</param> | <param name="target">The user you want to target this permission value for.</param> | ||||
<param name="allow">The value of this permission.</param> | <param name="allow">The value of this permission.</param> | ||||
</member> | </member> | ||||
<member name="M:Discord.ApplicationCommandPermission.#ctor(Discord.IRole,System.Boolean)"> | <member name="M:Discord.ApplicationCommandPermission.#ctor(Discord.IRole,System.Boolean)"> | ||||
<summary> | <summary> | ||||
Creates a new <see cref="T:Discord.ApplicationCommandPermission"/> targeting <see cref="F:Discord.PermissionTarget.Role"/>. | |||||
Creates a new <see cref="T:Discord.ApplicationCommandPermission"/> targeting <see cref="F:Discord.ApplicationCommandPermissionTarget.Role"/>. | |||||
</summary> | </summary> | ||||
<param name="target">The role you want to target this permission value for.</param> | <param name="target">The role you want to target this permission value for.</param> | ||||
<param name="allow">The value of this permission.</param> | <param name="allow">The value of this permission.</param> | ||||
</member> | </member> | ||||
<member name="T:Discord.ApplicationCommandPermissionTarget"> | |||||
<summary> | |||||
Specifies the target of the permission. | |||||
</summary> | |||||
</member> | |||||
<member name="F:Discord.ApplicationCommandPermissionTarget.Role"> | |||||
<summary> | |||||
The target of the permission is a role. | |||||
</summary> | |||||
</member> | |||||
<member name="F:Discord.ApplicationCommandPermissionTarget.User"> | |||||
<summary> | |||||
The target of the permission is a user. | |||||
</summary> | |||||
</member> | |||||
<member name="T:Discord.ChannelPermission"> | <member name="T:Discord.ChannelPermission"> | ||||
<summary> Defines the available permissions for a channel. </summary> | <summary> Defines the available permissions for a channel. </summary> | ||||
</member> | </member> | ||||
@@ -8,10 +8,10 @@ namespace Discord | |||||
/// <summary> | /// <summary> | ||||
/// The target of the permission is a role. | /// The target of the permission is a role. | ||||
/// </summary> | /// </summary> | ||||
Role = 1, | |||||
Role = 0, | |||||
/// <summary> | /// <summary> | ||||
/// The target of the permission is a user. | /// The target of the permission is a user. | ||||
/// </summary> | /// </summary> | ||||
User = 2, | |||||
User = 1, | |||||
} | } | ||||
} | } |
@@ -0,0 +1,23 @@ | |||||
using System; | |||||
using System.Collections.Generic; | |||||
using System.Linq; | |||||
using System.Text; | |||||
using System.Threading.Tasks; | |||||
namespace Discord | |||||
{ | |||||
/// <summary> | |||||
/// Specifies the target of the permission. | |||||
/// </summary> | |||||
public enum ApplicationCommandPermissionTarget | |||||
{ | |||||
/// <summary> | |||||
/// The target of the permission is a role. | |||||
/// </summary> | |||||
Role = 1, | |||||
/// <summary> | |||||
/// The target of the permission is a user. | |||||
/// </summary> | |||||
User = 2, | |||||
} | |||||
} |
@@ -13,7 +13,7 @@ namespace Discord | |||||
/// <summary> | /// <summary> | ||||
/// The target of this permission. | /// The target of this permission. | ||||
/// </summary> | /// </summary> | ||||
public PermissionTarget TargetType { get; } | |||||
public ApplicationCommandPermissionTarget TargetType { get; } | |||||
/// <summary> | /// <summary> | ||||
/// <see langword="true"/> to allow, otherwise <see langword="false"/>. | /// <see langword="true"/> to allow, otherwise <see langword="false"/>. | ||||
@@ -28,7 +28,7 @@ namespace Discord | |||||
/// <param name="targetId">The id you want to target this permission value for.</param> | /// <param name="targetId">The id you want to target this permission value for.</param> | ||||
/// <param name="targetType">The type of the <b>targetId</b> parameter.</param> | /// <param name="targetType">The type of the <b>targetId</b> parameter.</param> | ||||
/// <param name="allow">The value of this permission.</param> | /// <param name="allow">The value of this permission.</param> | ||||
public ApplicationCommandPermission(ulong targetId, PermissionTarget targetType, bool allow) | |||||
public ApplicationCommandPermission(ulong targetId, ApplicationCommandPermissionTarget targetType, bool allow) | |||||
{ | { | ||||
this.TargetId = targetId; | this.TargetId = targetId; | ||||
this.TargetType = targetType; | this.TargetType = targetType; | ||||
@@ -36,7 +36,7 @@ namespace Discord | |||||
} | } | ||||
/// <summary> | /// <summary> | ||||
/// Creates a new <see cref="ApplicationCommandPermission"/> targeting <see cref="PermissionTarget.User"/>. | |||||
/// Creates a new <see cref="ApplicationCommandPermission"/> targeting <see cref="ApplicationCommandPermissionTarget.User"/>. | |||||
/// </summary> | /// </summary> | ||||
/// <param name="target">The user you want to target this permission value for.</param> | /// <param name="target">The user you want to target this permission value for.</param> | ||||
/// <param name="allow">The value of this permission.</param> | /// <param name="allow">The value of this permission.</param> | ||||
@@ -44,11 +44,11 @@ namespace Discord | |||||
{ | { | ||||
this.TargetId = target.Id; | this.TargetId = target.Id; | ||||
this.Permission = allow; | this.Permission = allow; | ||||
this.TargetType = PermissionTarget.User; | |||||
this.TargetType = ApplicationCommandPermissionTarget.User; | |||||
} | } | ||||
/// <summary> | /// <summary> | ||||
/// Creates a new <see cref="ApplicationCommandPermission"/> targeting <see cref="PermissionTarget.Role"/>. | |||||
/// Creates a new <see cref="ApplicationCommandPermission"/> targeting <see cref="ApplicationCommandPermissionTarget.Role"/>. | |||||
/// </summary> | /// </summary> | ||||
/// <param name="target">The role you want to target this permission value for.</param> | /// <param name="target">The role you want to target this permission value for.</param> | ||||
/// <param name="allow">The value of this permission.</param> | /// <param name="allow">The value of this permission.</param> | ||||
@@ -56,7 +56,7 @@ namespace Discord | |||||
{ | { | ||||
this.TargetId = target.Id; | this.TargetId = target.Id; | ||||
this.Permission = allow; | this.Permission = allow; | ||||
this.TargetType = PermissionTarget.Role; | |||||
this.TargetType = ApplicationCommandPermissionTarget.Role; | |||||
} | } | ||||
} | } | ||||
} | } |
@@ -13,7 +13,7 @@ namespace Discord.API | |||||
public ulong Id { get; set; } | public ulong Id { get; set; } | ||||
[JsonProperty("type")] | [JsonProperty("type")] | ||||
public PermissionTarget Type { get; set; } | |||||
public ApplicationCommandPermissionTarget Type { get; set; } | |||||
[JsonProperty("permission")] | [JsonProperty("permission")] | ||||
public bool Permission { get; set; } | public bool Permission { get; set; } | ||||
@@ -3223,14 +3223,19 @@ | |||||
The message that contained the trigger for this interaction. | The message that contained the trigger for this interaction. | ||||
</summary> | </summary> | ||||
</member> | </member> | ||||
<member name="M:Discord.WebSocket.SocketMessageComponent.RespondAsync(System.String,System.Boolean,Discord.Embed[],Discord.InteractionResponseType,System.Boolean,Discord.AllowedMentions,Discord.RequestOptions,Discord.MessageComponent)"> | |||||
<member name="M:Discord.WebSocket.SocketMessageComponent.RespondAsync(Discord.Embed[],System.String,System.Boolean,Discord.InteractionResponseType,System.Boolean,Discord.AllowedMentions,Discord.RequestOptions,Discord.MessageComponent)"> | |||||
<inheritdoc/> | <inheritdoc/> | ||||
</member> | </member> | ||||
<member name="M:Discord.WebSocket.SocketMessageComponent.FollowupAsync(System.String,System.Boolean,Discord.Embed[],System.Boolean,Discord.InteractionResponseType,Discord.AllowedMentions,Discord.RequestOptions,Discord.MessageComponent)"> | |||||
<member name="M:Discord.WebSocket.SocketMessageComponent.FollowupAsync(Discord.Embed[],System.String,System.Boolean,System.Boolean,Discord.InteractionResponseType,Discord.AllowedMentions,Discord.RequestOptions,Discord.MessageComponent)"> | |||||
<inheritdoc/> | <inheritdoc/> | ||||
</member> | </member> | ||||
<member name="M:Discord.WebSocket.SocketMessageComponent.AcknowledgeAsync(Discord.RequestOptions)"> | <member name="M:Discord.WebSocket.SocketMessageComponent.AcknowledgeAsync(Discord.RequestOptions)"> | ||||
<inheritdoc/> | |||||
<summary> | |||||
Acknowledges this interaction with the <see cref="F:Discord.InteractionResponseType.DeferredUpdateMessage"/>. | |||||
</summary> | |||||
<returns> | |||||
A task that represents the asynchronous operation of acknowledging the interaction. | |||||
</returns> | |||||
</member> | </member> | ||||
<member name="T:Discord.WebSocket.SocketMessageComponentData"> | <member name="T:Discord.WebSocket.SocketMessageComponentData"> | ||||
<summary> | <summary> | ||||
@@ -3336,10 +3341,13 @@ | |||||
The data associated with this interaction. | The data associated with this interaction. | ||||
</summary> | </summary> | ||||
</member> | </member> | ||||
<member name="M:Discord.WebSocket.SocketSlashCommand.RespondAsync(System.String,System.Boolean,Discord.Embed[],Discord.InteractionResponseType,System.Boolean,Discord.AllowedMentions,Discord.RequestOptions,Discord.MessageComponent)"> | |||||
<member name="M:Discord.WebSocket.SocketSlashCommand.RespondAsync(Discord.Embed[],System.String,System.Boolean,Discord.InteractionResponseType,System.Boolean,Discord.AllowedMentions,Discord.RequestOptions,Discord.MessageComponent)"> | |||||
<inheritdoc/> | |||||
</member> | |||||
<member name="M:Discord.WebSocket.SocketSlashCommand.FollowupAsync(Discord.Embed[],System.String,System.Boolean,System.Boolean,Discord.InteractionResponseType,Discord.AllowedMentions,Discord.RequestOptions,Discord.MessageComponent)"> | |||||
<inheritdoc/> | <inheritdoc/> | ||||
</member> | </member> | ||||
<member name="M:Discord.WebSocket.SocketSlashCommand.FollowupAsync(System.String,System.Boolean,Discord.Embed[],System.Boolean,Discord.InteractionResponseType,Discord.AllowedMentions,Discord.RequestOptions,Discord.MessageComponent)"> | |||||
<member name="M:Discord.WebSocket.SocketSlashCommand.AcknowledgeAsync(Discord.RequestOptions)"> | |||||
<inheritdoc/> | <inheritdoc/> | ||||
</member> | </member> | ||||
<member name="T:Discord.WebSocket.SocketSlashCommandData"> | <member name="T:Discord.WebSocket.SocketSlashCommandData"> | ||||
@@ -3422,7 +3430,7 @@ | |||||
Responds to an Interaction. | Responds to an Interaction. | ||||
<para> | <para> | ||||
If you have <see cref="P:Discord.WebSocket.DiscordSocketConfig.AlwaysAcknowledgeInteractions"/> set to <see langword="true"/>, You should use | If you have <see cref="P:Discord.WebSocket.DiscordSocketConfig.AlwaysAcknowledgeInteractions"/> set to <see langword="true"/>, You should use | ||||
<see cref="M:Discord.WebSocket.SocketInteraction.FollowupAsync(System.String,System.Boolean,Discord.Embed[],System.Boolean,Discord.InteractionResponseType,Discord.AllowedMentions,Discord.RequestOptions,Discord.MessageComponent)"/> instead. | |||||
<see cref="M:Discord.WebSocket.SocketInteraction.FollowupAsync(Discord.Embed[],System.String,System.Boolean,System.Boolean,Discord.InteractionResponseType,Discord.AllowedMentions,Discord.RequestOptions,Discord.MessageComponent)"/> instead. | |||||
</para> | </para> | ||||
</summary> | </summary> | ||||
<param name="text">The text of the message to be sent.</param> | <param name="text">The text of the message to be sent.</param> | ||||
@@ -3452,12 +3460,12 @@ | |||||
The sent message. | The sent message. | ||||
</returns> | </returns> | ||||
</member> | </member> | ||||
<member name="M:Discord.WebSocket.SocketInteraction.RespondAsync(System.String,System.Boolean,Discord.Embed[],Discord.InteractionResponseType,System.Boolean,Discord.AllowedMentions,Discord.RequestOptions,Discord.MessageComponent)"> | |||||
<member name="M:Discord.WebSocket.SocketInteraction.RespondAsync(Discord.Embed[],System.String,System.Boolean,Discord.InteractionResponseType,System.Boolean,Discord.AllowedMentions,Discord.RequestOptions,Discord.MessageComponent)"> | |||||
<summary> | <summary> | ||||
Responds to an Interaction. | Responds to an Interaction. | ||||
<para> | <para> | ||||
If you have <see cref="P:Discord.WebSocket.DiscordSocketConfig.AlwaysAcknowledgeInteractions"/> set to <see langword="true"/>, You should use | If you have <see cref="P:Discord.WebSocket.DiscordSocketConfig.AlwaysAcknowledgeInteractions"/> set to <see langword="true"/>, You should use | ||||
<see cref="M:Discord.WebSocket.SocketInteraction.FollowupAsync(System.String,System.Boolean,Discord.Embed[],System.Boolean,Discord.InteractionResponseType,Discord.AllowedMentions,Discord.RequestOptions,Discord.MessageComponent)"/> instead. | |||||
<see cref="M:Discord.WebSocket.SocketInteraction.FollowupAsync(Discord.Embed[],System.String,System.Boolean,System.Boolean,Discord.InteractionResponseType,Discord.AllowedMentions,Discord.RequestOptions,Discord.MessageComponent)"/> instead. | |||||
</para> | </para> | ||||
</summary> | </summary> | ||||
<param name="text">The text of the message to be sent.</param> | <param name="text">The text of the message to be sent.</param> | ||||
@@ -3471,7 +3479,7 @@ | |||||
<exception cref="T:System.ArgumentOutOfRangeException">Message content is too long, length must be less or equal to <see cref="F:Discord.DiscordConfig.MaxMessageSize"/>.</exception> | <exception cref="T:System.ArgumentOutOfRangeException">Message content is too long, length must be less or equal to <see cref="F:Discord.DiscordConfig.MaxMessageSize"/>.</exception> | ||||
<exception cref="T:System.InvalidOperationException">The parameters provided were invalid or the token was invalid.</exception> | <exception cref="T:System.InvalidOperationException">The parameters provided were invalid or the token was invalid.</exception> | ||||
</member> | </member> | ||||
<member name="M:Discord.WebSocket.SocketInteraction.FollowupAsync(System.String,System.Boolean,Discord.Embed[],System.Boolean,Discord.InteractionResponseType,Discord.AllowedMentions,Discord.RequestOptions,Discord.MessageComponent)"> | |||||
<member name="M:Discord.WebSocket.SocketInteraction.FollowupAsync(Discord.Embed[],System.String,System.Boolean,System.Boolean,Discord.InteractionResponseType,Discord.AllowedMentions,Discord.RequestOptions,Discord.MessageComponent)"> | |||||
<summary> | <summary> | ||||
Sends a followup message for this interaction. | Sends a followup message for this interaction. | ||||
</summary> | </summary> | ||||
@@ -50,7 +50,7 @@ namespace Discord.WebSocket | |||||
{ | { | ||||
if (this.Message == null) | if (this.Message == null) | ||||
{ | { | ||||
SocketUser author = null; | |||||
SocketUser author; | |||||
if (this.Channel is SocketGuildChannel channel) | if (this.Channel is SocketGuildChannel channel) | ||||
{ | { | ||||
if (model.Message.Value.WebhookId.IsSpecified) | if (model.Message.Value.WebhookId.IsSpecified) | ||||
@@ -71,7 +71,7 @@ namespace Discord.WebSocket | |||||
} | } | ||||
/// <inheritdoc/> | /// <inheritdoc/> | ||||
public override async Task RespondAsync(string text = null, bool isTTS = false, Embed[] embeds = null, InteractionResponseType type = InteractionResponseType.ChannelMessageWithSource, | |||||
public override async Task RespondAsync(Embed[] embeds = null, string text = null, bool isTTS = false, InteractionResponseType type = InteractionResponseType.ChannelMessageWithSource, | |||||
bool ephemeral = false, AllowedMentions allowedMentions = null, RequestOptions options = null, MessageComponent component = null) | bool ephemeral = false, AllowedMentions allowedMentions = null, RequestOptions options = null, MessageComponent component = null) | ||||
{ | { | ||||
if (type == InteractionResponseType.Pong) | if (type == InteractionResponseType.Pong) | ||||
@@ -82,7 +82,7 @@ namespace Discord.WebSocket | |||||
if (Discord.AlwaysAcknowledgeInteractions) | if (Discord.AlwaysAcknowledgeInteractions) | ||||
{ | { | ||||
await FollowupAsync(text, isTTS, embeds, ephemeral, type, allowedMentions, options); | |||||
await FollowupAsync(embeds, text, isTTS, ephemeral, type, allowedMentions, options); | |||||
return; | return; | ||||
} | } | ||||
@@ -128,7 +128,7 @@ namespace Discord.WebSocket | |||||
} | } | ||||
/// <inheritdoc/> | /// <inheritdoc/> | ||||
public override async Task<RestFollowupMessage> FollowupAsync(string text = null, bool isTTS = false, Embed[] embeds = null, bool ephemeral = false, | |||||
public override async Task<RestFollowupMessage> FollowupAsync(Embed[] embeds = null, string text = null, bool isTTS = false, bool ephemeral = false, | |||||
InteractionResponseType type = InteractionResponseType.ChannelMessageWithSource, | InteractionResponseType type = InteractionResponseType.ChannelMessageWithSource, | ||||
AllowedMentions allowedMentions = null, RequestOptions options = null, MessageComponent component = null) | AllowedMentions allowedMentions = null, RequestOptions options = null, MessageComponent component = null) | ||||
{ | { | ||||
@@ -158,7 +158,12 @@ namespace Discord.WebSocket | |||||
return await InteractionHelper.SendFollowupAsync(Discord.Rest, args, Token, Channel, options); | return await InteractionHelper.SendFollowupAsync(Discord.Rest, args, Token, Channel, options); | ||||
} | } | ||||
/// <inheritdoc/> | |||||
/// <summary> | |||||
/// Acknowledges this interaction with the <see cref="InteractionResponseType.DeferredUpdateMessage"/>. | |||||
/// </summary> | |||||
/// <returns> | |||||
/// A task that represents the asynchronous operation of acknowledging the interaction. | |||||
/// </returns> | |||||
public override Task AcknowledgeAsync(RequestOptions options = null) | public override Task AcknowledgeAsync(RequestOptions options = null) | ||||
{ | { | ||||
var response = new API.InteractionResponse() | var response = new API.InteractionResponse() | ||||
@@ -51,7 +51,7 @@ namespace Discord.WebSocket | |||||
} | } | ||||
/// <inheritdoc/> | /// <inheritdoc/> | ||||
public override async Task RespondAsync(string text = null, bool isTTS = false, Embed[] embeds = null, InteractionResponseType type = InteractionResponseType.ChannelMessageWithSource, | |||||
public override async Task RespondAsync(Embed[] embeds = null, string text = null, bool isTTS = false, InteractionResponseType type = InteractionResponseType.ChannelMessageWithSource, | |||||
bool ephemeral = false, AllowedMentions allowedMentions = null, RequestOptions options = null, MessageComponent component = null) | bool ephemeral = false, AllowedMentions allowedMentions = null, RequestOptions options = null, MessageComponent component = null) | ||||
{ | { | ||||
if (type == InteractionResponseType.Pong) | if (type == InteractionResponseType.Pong) | ||||
@@ -65,7 +65,7 @@ namespace Discord.WebSocket | |||||
if (Discord.AlwaysAcknowledgeInteractions) | if (Discord.AlwaysAcknowledgeInteractions) | ||||
{ | { | ||||
await FollowupAsync(text, isTTS, embeds, ephemeral, type, allowedMentions, options); | |||||
await FollowupAsync(embeds, text, isTTS, ephemeral, type, allowedMentions, options); | |||||
return; | return; | ||||
} | } | ||||
@@ -111,7 +111,7 @@ namespace Discord.WebSocket | |||||
} | } | ||||
/// <inheritdoc/> | /// <inheritdoc/> | ||||
public override async Task<RestFollowupMessage> FollowupAsync(string text = null, bool isTTS = false, Embed[] embeds = null, bool ephemeral = false, | |||||
public override async Task<RestFollowupMessage> FollowupAsync(Embed[] embeds = null, string text = null, bool isTTS = false, bool ephemeral = false, | |||||
InteractionResponseType type = InteractionResponseType.ChannelMessageWithSource, | InteractionResponseType type = InteractionResponseType.ChannelMessageWithSource, | ||||
AllowedMentions allowedMentions = null, RequestOptions options = null, MessageComponent component = null) | AllowedMentions allowedMentions = null, RequestOptions options = null, MessageComponent component = null) | ||||
{ | { | ||||
@@ -140,5 +140,16 @@ namespace Discord.WebSocket | |||||
return await InteractionHelper.SendFollowupAsync(Discord.Rest, args, Token, Channel, options); | return await InteractionHelper.SendFollowupAsync(Discord.Rest, args, Token, Channel, options); | ||||
} | } | ||||
/// <inheritdoc/> | |||||
public override Task AcknowledgeAsync(RequestOptions options = null) | |||||
{ | |||||
var response = new API.InteractionResponse() | |||||
{ | |||||
Type = InteractionResponseType.DeferredChannelMessageWithSource, | |||||
}; | |||||
return Discord.Rest.ApiClient.CreateInteractionResponse(response, this.Id, this.Token, options); | |||||
} | |||||
} | } | ||||
} | } |
@@ -99,7 +99,7 @@ namespace Discord.WebSocket | |||||
/// Responds to an Interaction. | /// Responds to an Interaction. | ||||
/// <para> | /// <para> | ||||
/// If you have <see cref="DiscordSocketConfig.AlwaysAcknowledgeInteractions"/> set to <see langword="true"/>, You should use | /// If you have <see cref="DiscordSocketConfig.AlwaysAcknowledgeInteractions"/> set to <see langword="true"/>, You should use | ||||
/// <see cref="FollowupAsync(string, bool, Embed[], bool, InteractionResponseType, AllowedMentions, RequestOptions, MessageComponent)"/> instead. | |||||
/// <see cref="FollowupAsync(Embed[],string, bool, bool, InteractionResponseType, AllowedMentions, RequestOptions, MessageComponent)"/> instead. | |||||
/// </para> | /// </para> | ||||
/// </summary> | /// </summary> | ||||
/// <param name="text">The text of the message to be sent.</param> | /// <param name="text">The text of the message to be sent.</param> | ||||
@@ -114,7 +114,7 @@ namespace Discord.WebSocket | |||||
/// <exception cref="InvalidOperationException">The parameters provided were invalid or the token was invalid.</exception> | /// <exception cref="InvalidOperationException">The parameters provided were invalid or the token was invalid.</exception> | ||||
public Task RespondAsync(string text = null, bool isTTS = false, Embed embed = null, InteractionResponseType type = InteractionResponseType.ChannelMessageWithSource, | public Task RespondAsync(string text = null, bool isTTS = false, Embed embed = null, InteractionResponseType type = InteractionResponseType.ChannelMessageWithSource, | ||||
bool ephemeral = false, AllowedMentions allowedMentions = null, RequestOptions options = null, MessageComponent component = null) | bool ephemeral = false, AllowedMentions allowedMentions = null, RequestOptions options = null, MessageComponent component = null) | ||||
=> RespondAsync(text, isTTS, new Embed[] { embed }, type, ephemeral, allowedMentions, options, component); | |||||
=> RespondAsync(embed != null ? new Embed[] { embed } : null, text, isTTS, type, ephemeral, allowedMentions, options, component); | |||||
/// <summary> | /// <summary> | ||||
/// Sends a followup message for this interaction. | /// Sends a followup message for this interaction. | ||||
@@ -132,12 +132,12 @@ namespace Discord.WebSocket | |||||
/// </returns> | /// </returns> | ||||
public Task FollowupAsync(string text = null, bool isTTS = false, Embed embed = null, InteractionResponseType type = InteractionResponseType.ChannelMessageWithSource, | public Task FollowupAsync(string text = null, bool isTTS = false, Embed embed = null, InteractionResponseType type = InteractionResponseType.ChannelMessageWithSource, | ||||
bool ephemeral = false, AllowedMentions allowedMentions = null, RequestOptions options = null, MessageComponent component = null) | bool ephemeral = false, AllowedMentions allowedMentions = null, RequestOptions options = null, MessageComponent component = null) | ||||
=> RespondAsync(text, isTTS, new Embed[] { embed }, type, ephemeral, allowedMentions, options, component); | |||||
=> RespondAsync(embed != null ? new Embed[] { embed } : null, text, isTTS, type, ephemeral, allowedMentions, options, component); | |||||
/// <summary> | /// <summary> | ||||
/// Responds to an Interaction. | /// Responds to an Interaction. | ||||
/// <para> | /// <para> | ||||
/// If you have <see cref="DiscordSocketConfig.AlwaysAcknowledgeInteractions"/> set to <see langword="true"/>, You should use | /// If you have <see cref="DiscordSocketConfig.AlwaysAcknowledgeInteractions"/> set to <see langword="true"/>, You should use | ||||
/// <see cref="FollowupAsync(string, bool, Embed[], bool, InteractionResponseType, AllowedMentions, RequestOptions, MessageComponent)"/> instead. | |||||
/// <see cref="FollowupAsync( Embed[],string, bool, bool, InteractionResponseType, AllowedMentions, RequestOptions, MessageComponent)"/> instead. | |||||
/// </para> | /// </para> | ||||
/// </summary> | /// </summary> | ||||
/// <param name="text">The text of the message to be sent.</param> | /// <param name="text">The text of the message to be sent.</param> | ||||
@@ -151,7 +151,7 @@ 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="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> | /// <exception cref="InvalidOperationException">The parameters provided were invalid or the token was invalid.</exception> | ||||
public abstract Task RespondAsync(string text = null, bool isTTS = false, Embed[] embeds = null, InteractionResponseType type = InteractionResponseType.ChannelMessageWithSource, | |||||
public abstract Task RespondAsync(Embed[] embeds = null, string text = null, bool isTTS = false, InteractionResponseType type = InteractionResponseType.ChannelMessageWithSource, | |||||
bool ephemeral = false, AllowedMentions allowedMentions = null, RequestOptions options = null, MessageComponent component = null); | bool ephemeral = false, AllowedMentions allowedMentions = null, RequestOptions options = null, MessageComponent component = null); | ||||
/// <summary> | /// <summary> | ||||
@@ -168,7 +168,7 @@ namespace Discord.WebSocket | |||||
/// <returns> | /// <returns> | ||||
/// The sent message. | /// The sent message. | ||||
/// </returns> | /// </returns> | ||||
public abstract Task<RestFollowupMessage> FollowupAsync(string text = null, bool isTTS = false, Embed[] embeds = null, bool ephemeral = false, | |||||
public abstract Task<RestFollowupMessage> FollowupAsync(Embed[] embeds = null, string text = null, bool isTTS = false, bool ephemeral = false, | |||||
InteractionResponseType type = InteractionResponseType.ChannelMessageWithSource, | InteractionResponseType type = InteractionResponseType.ChannelMessageWithSource, | ||||
AllowedMentions allowedMentions = null, RequestOptions options = null, MessageComponent component = null); | AllowedMentions allowedMentions = null, RequestOptions options = null, MessageComponent component = null); | ||||
@@ -186,15 +186,7 @@ namespace Discord.WebSocket | |||||
/// <returns> | /// <returns> | ||||
/// A task that represents the asynchronous operation of acknowledging the interaction. | /// A task that represents the asynchronous operation of acknowledging the interaction. | ||||
/// </returns> | /// </returns> | ||||
public virtual Task AcknowledgeAsync(RequestOptions options = null) | |||||
{ | |||||
var response = new API.InteractionResponse() | |||||
{ | |||||
Type = InteractionResponseType.DeferredChannelMessageWithSource, | |||||
}; | |||||
return Discord.Rest.ApiClient.CreateInteractionResponse(response, this.Id, this.Token, options); | |||||
} | |||||
public abstract Task AcknowledgeAsync(RequestOptions options = null); | |||||
private bool CheckToken() | private bool CheckToken() | ||||
{ | { | ||||