From a98417e177c190b89690b3527a2eace38f643bec Mon Sep 17 00:00:00 2001 From: quin lynch Date: Tue, 21 Sep 2021 14:23:23 -0300 Subject: [PATCH 1/2] Update Discord.Net.Commands.xml --- src/Discord.Net.Commands/Discord.Net.Commands.xml | 4 +++- 1 file changed, 3 insertions(+), 1 deletion(-) diff --git a/src/Discord.Net.Commands/Discord.Net.Commands.xml b/src/Discord.Net.Commands/Discord.Net.Commands.xml index 7da918622..e44d71229 100644 --- a/src/Discord.Net.Commands/Discord.Net.Commands.xml +++ b/src/Discord.Net.Commands/Discord.Net.Commands.xml @@ -1129,7 +1129,7 @@ - + Sends a message to the source channel. @@ -1143,6 +1143,8 @@ If null, all mentioned roles and users will be notified. The message references to be included. Used to reply to specific messages. + The message components to be included with this message. Used for interactions + A collection of stickers to send with the file. From bbf9a7af0fc9464d20efaf77b84184c4b414ea09 Mon Sep 17 00:00:00 2001 From: quin lynch Date: Tue, 21 Sep 2021 14:32:57 -0300 Subject: [PATCH 2/2] deprecated always ack, fixed methods naming conventions to use async --- src/Discord.Net.Core/Discord.Net.Core.xml | 51 ++++++++++++++----- src/Discord.Net.Rest/Discord.Net.Rest.xml | 15 ++++++ src/Discord.Net.Rest/DiscordRestApiClient.cs | 46 ++++++++--------- .../Interactions/InteractionHelper.cs | 30 +++++------ .../Entities/Roles/RestRole.cs | 2 + .../Discord.Net.WebSocket.xml | 40 ++++++--------- .../DiscordSocketClient.cs | 6 --- .../DiscordSocketConfig.cs | 23 --------- .../SocketMessageComponent.cs | 10 +--- .../SocketBaseCommand/SocketCommandBase.cs | 8 +-- 10 files changed, 113 insertions(+), 118 deletions(-) diff --git a/src/Discord.Net.Core/Discord.Net.Core.xml b/src/Discord.Net.Core/Discord.Net.Core.xml index 220f3fae4..38b0fa310 100644 --- a/src/Discord.Net.Core/Discord.Net.Core.xml +++ b/src/Discord.Net.Core/Discord.Net.Core.xml @@ -3747,6 +3747,13 @@ The options to be used when sending the request. A guild user associated with the specified ; if the user is already in the guild. + + + Disconnects the user from its current voice channel + + The user to disconnect. + A task that represents the asynchronous operation for disconnecting a user. + Gets a collection of all users in this guild. @@ -3936,6 +3943,14 @@ emote. + + + Moves the user to the voice channel. + + The user to move. + the channel where the user gets moved to. + A task that represents the asynchronous operation for moving a user. + Deletes an existing from this guild. @@ -4992,6 +5007,16 @@ ACK a Ping. + + + ACK a command without sending a message, eating the user's input. + + + + + Respond with a message, showing the user's input. + + Respond to an interaction with a message. @@ -5129,11 +5154,6 @@ Represents a builder for creating a . - - - The max length of a . - - The max length of a . @@ -5266,7 +5286,7 @@ Represents a class used to build 's. - + The max length of a . @@ -5275,13 +5295,15 @@ Gets or sets the label of the current button. - length exceeds . + length exceeds . + length exceeds . Gets or sets the custom id of the current button. length exceeds + length subceeds 1. @@ -5448,13 +5470,15 @@ Gets or sets the custom id of the current select menu. - length exceeds . + length exceeds + length subceeds 1. Gets or sets the placeholder text of the current select menu. length exceeds . + length subceeds 1. @@ -5595,7 +5619,7 @@ Represents a class used to build 's. - + The maximum length of a . @@ -5605,9 +5629,9 @@ The maximum length of a . - + - The maximum length of a . + The maximum length of a . @@ -5615,18 +5639,21 @@ Gets or sets the label of the current select menu. length exceeds + length subceeds 1. Gets or sets the custom id of the current select menu. - length exceeds . + length exceeds . + length subceeds 1. Gets or sets this menu options description. length exceeds . + length subceeds 1. diff --git a/src/Discord.Net.Rest/Discord.Net.Rest.xml b/src/Discord.Net.Rest/Discord.Net.Rest.xml index 43c2a05bc..6e6b76d21 100644 --- a/src/Discord.Net.Rest/Discord.Net.Rest.xml +++ b/src/Discord.Net.Rest/Discord.Net.Rest.xml @@ -3617,6 +3617,14 @@ is . + + + Moves the user to the voice channel. + + The user to move. + the channel where the user gets moved to. + A task that represents the asynchronous operation for moving a user. + @@ -3802,6 +3810,13 @@ + + + Disconnects the user from its current voice channel + + The user to disconnect. + A task that represents the asynchronous operation for disconnecting a user. + diff --git a/src/Discord.Net.Rest/DiscordRestApiClient.cs b/src/Discord.Net.Rest/DiscordRestApiClient.cs index 0db6985b0..f132cb7a4 100644 --- a/src/Discord.Net.Rest/DiscordRestApiClient.cs +++ b/src/Discord.Net.Rest/DiscordRestApiClient.cs @@ -897,7 +897,7 @@ namespace Discord.API } #endregion - #region Stickers + #region Stickers, Reactions, Crosspost, and Acks public async Task GetStickerAsync(ulong id, RequestOptions options = null) { Preconditions.NotEqual(id, 0, nameof(id)); @@ -1166,25 +1166,25 @@ namespace Discord.API options = RequestOptions.CreateOrClone(options); - return await TrySendApplicationCommand(SendJsonAsync("POST", () => $"applications/{this.CurrentUserId}/commands", command, new BucketIds(), options: options)).ConfigureAwait(false); + return await TrySendApplicationCommandAsync(SendJsonAsync("POST", () => $"applications/{this.CurrentUserId}/commands", command, new BucketIds(), options: options)).ConfigureAwait(false); } public async Task ModifyGlobalApplicationCommandAsync(ModifyApplicationCommandParams command, ulong commandId, RequestOptions options = null) { options = RequestOptions.CreateOrClone(options); - return await TrySendApplicationCommand(SendJsonAsync("PATCH", () => $"applications/{this.CurrentUserId}/commands/{commandId}", command, new BucketIds(), options: options)).ConfigureAwait(false); + return await TrySendApplicationCommandAsync(SendJsonAsync("PATCH", () => $"applications/{this.CurrentUserId}/commands/{commandId}", command, new BucketIds(), options: options)).ConfigureAwait(false); } public async Task ModifyGlobalApplicationUserCommandAsync(ModifyApplicationCommandParams command, ulong commandId, RequestOptions options = null) { options = RequestOptions.CreateOrClone(options); - return await TrySendApplicationCommand(SendJsonAsync("PATCH", () => $"applications/{this.CurrentUserId}/commands/{commandId}", command, new BucketIds(), options: options)).ConfigureAwait(false); + return await TrySendApplicationCommandAsync(SendJsonAsync("PATCH", () => $"applications/{this.CurrentUserId}/commands/{commandId}", command, new BucketIds(), options: options)).ConfigureAwait(false); } public async Task ModifyGlobalApplicationMessageCommandAsync(ModifyApplicationCommandParams command, ulong commandId, RequestOptions options = null) { options = RequestOptions.CreateOrClone(options); - return await TrySendApplicationCommand(SendJsonAsync("PATCH", () => $"applications/{this.CurrentUserId}/commands/{commandId}", command, new BucketIds(), options: options)).ConfigureAwait(false); + return await TrySendApplicationCommandAsync(SendJsonAsync("PATCH", () => $"applications/{this.CurrentUserId}/commands/{commandId}", command, new BucketIds(), options: options)).ConfigureAwait(false); } public async Task DeleteGlobalApplicationCommandAsync(ulong commandId, RequestOptions options = null) { @@ -1193,11 +1193,11 @@ namespace Discord.API await SendAsync("DELETE", () => $"applications/{this.CurrentUserId}/commands/{commandId}", new BucketIds(), options: options).ConfigureAwait(false); } - public async Task BulkOverwriteGlobalApplicationCommands(CreateApplicationCommandParams[] commands, RequestOptions options = null) + public async Task BulkOverwriteGlobalApplicationCommandsAsync(CreateApplicationCommandParams[] commands, RequestOptions options = null) { options = RequestOptions.CreateOrClone(options); - return await TrySendApplicationCommand(SendJsonAsync("PUT", () => $"applications/{this.CurrentUserId}/commands", commands, new BucketIds(), options: options)).ConfigureAwait(false); + return await TrySendApplicationCommandAsync(SendJsonAsync("PUT", () => $"applications/{this.CurrentUserId}/commands", commands, new BucketIds(), options: options)).ConfigureAwait(false); } public async Task GetGuildApplicationCommandsAsync(ulong guildId, RequestOptions options = null) @@ -1239,7 +1239,7 @@ namespace Discord.API var bucket = new BucketIds(guildId: guildId); - return await TrySendApplicationCommand(SendJsonAsync("POST", () => $"applications/{this.CurrentUserId}/guilds/{guildId}/commands", command, bucket, options: options)).ConfigureAwait(false); + return await TrySendApplicationCommandAsync(SendJsonAsync("POST", () => $"applications/{this.CurrentUserId}/guilds/{guildId}/commands", command, bucket, options: options)).ConfigureAwait(false); } public async Task ModifyGuildApplicationCommandAsync(ModifyApplicationCommandParams command, ulong guildId, ulong commandId, RequestOptions options = null) { @@ -1247,7 +1247,7 @@ namespace Discord.API var bucket = new BucketIds(guildId: guildId); - return await TrySendApplicationCommand(SendJsonAsync("PATCH", () => $"applications/{this.CurrentUserId}/guilds/{guildId}/commands/{commandId}", command, bucket, options: options)).ConfigureAwait(false); + return await TrySendApplicationCommandAsync(SendJsonAsync("PATCH", () => $"applications/{this.CurrentUserId}/guilds/{guildId}/commands/{commandId}", command, bucket, options: options)).ConfigureAwait(false); } public async Task DeleteGuildApplicationCommandAsync(ulong guildId, ulong commandId, RequestOptions options = null) { @@ -1258,18 +1258,18 @@ namespace Discord.API await SendAsync("DELETE", () => $"applications/{this.CurrentUserId}/guilds/{guildId}/commands/{commandId}", bucket, options: options).ConfigureAwait(false); } - public async Task BulkOverwriteGuildApplicationCommands(ulong guildId, CreateApplicationCommandParams[] commands, RequestOptions options = null) + public async Task BulkOverwriteGuildApplicationCommandsAsync(ulong guildId, CreateApplicationCommandParams[] commands, RequestOptions options = null) { options = RequestOptions.CreateOrClone(options); var bucket = new BucketIds(guildId: guildId); - return await TrySendApplicationCommand(SendJsonAsync("PUT", () => $"applications/{this.CurrentUserId}/guilds/{guildId}/commands", commands, bucket, options: options)).ConfigureAwait(false); + return await TrySendApplicationCommandAsync(SendJsonAsync("PUT", () => $"applications/{this.CurrentUserId}/guilds/{guildId}/commands", commands, bucket, options: options)).ConfigureAwait(false); } #endregion #region Interaction Responses - public async Task CreateInteractionResponse(InteractionResponse response, ulong interactionId, string interactionToken, RequestOptions options = null) + public async Task CreateInteractionResponseAsync(InteractionResponse response, ulong interactionId, string interactionToken, RequestOptions options = null) { if(response.Data.IsSpecified && response.Data.Value.Content.IsSpecified) Preconditions.AtMost(response.Data.Value.Content.Value?.Length ?? 0, 2000, nameof(response.Data.Value.Content)); @@ -1278,7 +1278,7 @@ namespace Discord.API await SendJsonAsync("POST", () => $"interactions/{interactionId}/{interactionToken}/callback", response, new BucketIds(), options: options); } - public async Task GetInteractionResponse(string interactionToken, RequestOptions options = null) + public async Task GetInteractionResponseAsync(string interactionToken, RequestOptions options = null) { Preconditions.NotNullOrEmpty(interactionToken, nameof(interactionToken)); @@ -1286,20 +1286,20 @@ namespace Discord.API return await SendAsync("GET", () => $"webhooks/{this.CurrentUserId}/{interactionToken}/messages/@original", new BucketIds(), options: options).ConfigureAwait(false); } - public async Task ModifyInteractionResponse(ModifyInteractionResponseParams args, string interactionToken, RequestOptions options = null) + public async Task ModifyInteractionResponseAsync(ModifyInteractionResponseParams args, string interactionToken, RequestOptions options = null) { options = RequestOptions.CreateOrClone(options); return await SendJsonAsync("PATCH", () => $"webhooks/{this.CurrentUserId}/{interactionToken}/messages/@original", args, new BucketIds(), options: options); } - public async Task DeleteInteractionResponse(string interactionToken, RequestOptions options = null) + public async Task DeleteInteractionResponseAsync(string interactionToken, RequestOptions options = null) { options = RequestOptions.CreateOrClone(options); await SendAsync("DELETE", () => $"webhooks/{this.CurrentUserId}/{interactionToken}/messages/@original", new BucketIds(), options: options); } - public async Task CreateInteractionFollowupMessage(CreateWebhookMessageParams args, string token, RequestOptions options = null) + public async Task CreateInteractionFollowupMessageAsync(CreateWebhookMessageParams args, string token, RequestOptions options = null) { if ((!args.Embeds.IsSpecified || args.Embeds.Value == null || args.Embeds.Value.Length == 0) && !args.File.IsSpecified) Preconditions.NotNullOrEmpty(args.Content, nameof(args.Content)); @@ -1315,7 +1315,7 @@ namespace Discord.API return await SendMultipartAsync("POST", () => $"webhooks/{CurrentUserId}/{token}?wait=true", args.ToDictionary(), new BucketIds(), options: options).ConfigureAwait(false); } - public async Task ModifyInteractionFollowupMessage(ModifyInteractionResponseParams args, ulong id, string token, RequestOptions options = null) + public async Task ModifyInteractionFollowupMessageAsync(ModifyInteractionResponseParams args, ulong id, string token, RequestOptions options = null) { Preconditions.NotNull(args, nameof(args)); Preconditions.NotEqual(id, 0, nameof(id)); @@ -1329,7 +1329,7 @@ namespace Discord.API return await SendJsonAsync("PATCH", () => $"webhooks/{CurrentUserId}/{token}/messages/{id}", args, new BucketIds(), options: options).ConfigureAwait(false); } - public async Task DeleteInteractionFollowupMessage(ulong id, string token, RequestOptions options = null) + public async Task DeleteInteractionFollowupMessageAsync(ulong id, string token, RequestOptions options = null) { Preconditions.NotEqual(id, 0, nameof(id)); @@ -1340,7 +1340,7 @@ namespace Discord.API #endregion #region Application Command permissions - public async Task GetGuildApplicationCommandPermissions(ulong guildId, RequestOptions options = null) + public async Task GetGuildApplicationCommandPermissionsAsync(ulong guildId, RequestOptions options = null) { Preconditions.NotEqual(guildId, 0, nameof(guildId)); @@ -1349,7 +1349,7 @@ namespace Discord.API return await SendAsync("GET", () => $"applications/{this.CurrentUserId}/guilds/{guildId}/commands/permissions", new BucketIds(), options: options).ConfigureAwait(false); } - public async Task GetGuildApplicationCommandPermission(ulong guildId, ulong commandId, RequestOptions options = null) + public async Task GetGuildApplicationCommandPermissionAsync(ulong guildId, ulong commandId, RequestOptions options = null) { Preconditions.NotEqual(guildId, 0, nameof(guildId)); Preconditions.NotEqual(commandId, 0, nameof(commandId)); @@ -1359,7 +1359,7 @@ namespace Discord.API return await SendAsync("GET", () => $"applications/{this.CurrentUserId}/guilds/{guildId}/commands/{commandId}/permissions", new BucketIds(), options: options).ConfigureAwait(false); } - public async Task ModifyApplicationCommandPermissions(ModifyGuildApplicationCommandPermissionsParams permissions, ulong guildId, ulong commandId, RequestOptions options = null) + public async Task ModifyApplicationCommandPermissionsAsync(ModifyGuildApplicationCommandPermissionsParams permissions, ulong guildId, ulong commandId, RequestOptions options = null) { Preconditions.NotEqual(guildId, 0, nameof(guildId)); Preconditions.NotEqual(commandId, 0, nameof(commandId)); @@ -1369,7 +1369,7 @@ namespace Discord.API return await SendJsonAsync("PUT", () => $"applications/{this.CurrentUserId}/guilds/{guildId}/commands/{commandId}/permissions", permissions, new BucketIds(), options: options).ConfigureAwait(false); } - public async Task> BatchModifyApplicationCommandPermissions(ModifyGuildApplicationCommandPermissions[] permissions, ulong guildId, RequestOptions options = null) + public async Task> BatchModifyApplicationCommandPermissionsAsync(ModifyGuildApplicationCommandPermissions[] permissions, ulong guildId, RequestOptions options = null) { Preconditions.NotEqual(guildId, 0, nameof(guildId)); Preconditions.NotNull(permissions, nameof(permissions)); @@ -2091,7 +2091,7 @@ namespace Discord.API return _serializer.Deserialize(reader); } - protected async Task TrySendApplicationCommand(Task sendTask) + protected async Task TrySendApplicationCommandAsync(Task sendTask) { try { diff --git a/src/Discord.Net.Rest/Entities/Interactions/InteractionHelper.cs b/src/Discord.Net.Rest/Entities/Interactions/InteractionHelper.cs index 7a4b49166..e79cb6e2f 100644 --- a/src/Discord.Net.Rest/Entities/Interactions/InteractionHelper.cs +++ b/src/Discord.Net.Rest/Entities/Interactions/InteractionHelper.cs @@ -14,31 +14,31 @@ namespace Discord.Rest #region InteractionHelper public static Task DeleteAllGuildCommandsAsync(BaseDiscordClient client, ulong guildId, RequestOptions options = null) { - return client.ApiClient.BulkOverwriteGuildApplicationCommands(guildId, new CreateApplicationCommandParams[0], options); + return client.ApiClient.BulkOverwriteGuildApplicationCommandsAsync(guildId, new CreateApplicationCommandParams[0], options); } public static Task DeleteAllGlobalCommandsAsync(BaseDiscordClient client, RequestOptions options = null) { - return client.ApiClient.BulkOverwriteGlobalApplicationCommands(new CreateApplicationCommandParams[0], options); + return client.ApiClient.BulkOverwriteGlobalApplicationCommandsAsync(new CreateApplicationCommandParams[0], options); } public static Task SendInteractionResponse(BaseDiscordClient client, InteractionResponse response, ulong interactionId, string interactionToken, RequestOptions options = null) { - return client.ApiClient.CreateInteractionResponse(response, interactionId, interactionToken, options); + return client.ApiClient.CreateInteractionResponseAsync(response, interactionId, interactionToken, options); } public static async Task GetOriginalResponseAsync(BaseDiscordClient client, IMessageChannel channel, IDiscordInteraction interaction, RequestOptions options = null) { - var model = await client.ApiClient.GetInteractionResponse(interaction.Token, options).ConfigureAwait(false); + var model = await client.ApiClient.GetInteractionResponseAsync(interaction.Token, options).ConfigureAwait(false); return RestInteractionMessage.Create(client, model, interaction.Token, channel); } public static async Task SendFollowupAsync(BaseDiscordClient client, CreateWebhookMessageParams args, string token, IMessageChannel channel, RequestOptions options = null) { - var model = await client.ApiClient.CreateInteractionFollowupMessage(args, token, options).ConfigureAwait(false); + var model = await client.ApiClient.CreateInteractionFollowupMessageAsync(args, token, options).ConfigureAwait(false); RestFollowupMessage entity = RestFollowupMessage.Create(client, model, token, channel); return entity; @@ -123,7 +123,7 @@ namespace Discord.Rest models.Add(model); } - return await client.ApiClient.BulkOverwriteGlobalApplicationCommands(models.ToArray(), options).ConfigureAwait(false); + return await client.ApiClient.BulkOverwriteGlobalApplicationCommandsAsync(models.ToArray(), options).ConfigureAwait(false); } public static async Task> BulkOverwriteGuildCommands(BaseDiscordClient client, ulong guildId, @@ -160,7 +160,7 @@ namespace Discord.Rest models.Add(model); } - return await client.ApiClient.BulkOverwriteGuildApplicationCommands(guildId, models.ToArray(), options).ConfigureAwait(false); + return await client.ApiClient.BulkOverwriteGuildApplicationCommandsAsync(guildId, models.ToArray(), options).ConfigureAwait(false); } private static TArg GetApplicationCommandProperties(IApplicationCommand command) @@ -367,11 +367,11 @@ namespace Discord.Rest Components = args.Components.IsSpecified ? args.Components.Value?.Components.Select(x => new API.ActionRowComponent(x)).ToArray() : Optional.Unspecified, }; - return await client.ApiClient.ModifyInteractionFollowupMessage(apiArgs, message.Id, message.Token, options).ConfigureAwait(false); + return await client.ApiClient.ModifyInteractionFollowupMessageAsync(apiArgs, message.Id, message.Token, options).ConfigureAwait(false); } public static async Task DeleteFollowupMessage(BaseDiscordClient client, RestFollowupMessage message, RequestOptions options = null) - => await client.ApiClient.DeleteInteractionFollowupMessage(message.Id, message.Token, options); + => await client.ApiClient.DeleteInteractionFollowupMessageAsync(message.Id, message.Token, options); public static async Task ModifyInteractionResponse(BaseDiscordClient client, string token, Action func, RequestOptions options = null) @@ -411,18 +411,18 @@ namespace Discord.Rest Flags = args.Flags }; - return await client.ApiClient.ModifyInteractionResponse(apiArgs, token, options).ConfigureAwait(false); + return await client.ApiClient.ModifyInteractionResponseAsync(apiArgs, token, options).ConfigureAwait(false); } public static async Task DeletedInteractionResponse(BaseDiscordClient client, RestInteractionMessage message, RequestOptions options = null) - => await client.ApiClient.DeleteInteractionFollowupMessage(message.Id, message.Token, options); + => await client.ApiClient.DeleteInteractionFollowupMessageAsync(message.Id, message.Token, options); #endregion #region Guild permissions public static async Task> GetGuildCommandPermissionsAsync(BaseDiscordClient client, ulong guildId, RequestOptions options) { - var models = await client.ApiClient.GetGuildApplicationCommandPermissions(guildId, options); + var models = await client.ApiClient.GetGuildApplicationCommandPermissionsAsync(guildId, options); return models.Select(x => new GuildApplicationCommandPermission(x.Id, x.ApplicationId, guildId, x.Permissions.Select( y => new Discord.ApplicationCommandPermission(y.Id, y.Type, y.Permission)) @@ -435,7 +435,7 @@ namespace Discord.Rest { try { - var model = await client.ApiClient.GetGuildApplicationCommandPermission(guildId, commandId, options); + var model = await client.ApiClient.GetGuildApplicationCommandPermissionAsync(guildId, commandId, options); return new GuildApplicationCommandPermission(model.Id, model.ApplicationId, guildId, model.Permissions.Select( y => new ApplicationCommandPermission(y.Id, y.Type, y.Permission)).ToArray()); } @@ -473,7 +473,7 @@ namespace Discord.Rest Permissions = permissionsList.ToArray() }; - var apiModel = await client.ApiClient.ModifyApplicationCommandPermissions(model, guildId, commandId, options); + var apiModel = await client.ApiClient.ModifyApplicationCommandPermissionsAsync(model, guildId, commandId, options); return new GuildApplicationCommandPermission(apiModel.Id, apiModel.ApplicationId, guildId, apiModel.Permissions.Select( x => new ApplicationCommandPermission(x.Id, x.Type, x.Permission)).ToArray()); @@ -505,7 +505,7 @@ namespace Discord.Rest models.Add(model); } - var apiModels = await client.ApiClient.BatchModifyApplicationCommandPermissions(models.ToArray(), guildId, options); + var apiModels = await client.ApiClient.BatchModifyApplicationCommandPermissionsAsync(models.ToArray(), guildId, options); return apiModels.Select( x => new GuildApplicationCommandPermission(x.Id, x.ApplicationId, x.GuildId, x.Permissions.Select( diff --git a/src/Discord.Net.Rest/Entities/Roles/RestRole.cs b/src/Discord.Net.Rest/Entities/Roles/RestRole.cs index 03e954f47..69a2abe20 100644 --- a/src/Discord.Net.Rest/Entities/Roles/RestRole.cs +++ b/src/Discord.Net.Rest/Entities/Roles/RestRole.cs @@ -97,5 +97,7 @@ namespace Discord.Rest throw new InvalidOperationException("Unable to return this entity's parent unless it was fetched through that object."); } } + + #endregion } } diff --git a/src/Discord.Net.WebSocket/Discord.Net.WebSocket.xml b/src/Discord.Net.WebSocket/Discord.Net.WebSocket.xml index 610555b61..dd0866f0c 100644 --- a/src/Discord.Net.WebSocket/Discord.Net.WebSocket.xml +++ b/src/Discord.Net.WebSocket/Discord.Net.WebSocket.xml @@ -1393,29 +1393,6 @@ - - - Gets or sets whether or not interactions are acknowledge with source. - - - - Discord interactions will not appear in chat until the client responds to them. With this option set to - , the client will automatically acknowledge the interaction with . - See the docs on - responding to interactions for more info. - - - With this option set to , you will have to acknowledge the interaction with - . - Only after the interaction is acknowledged, the original slash command message will be visible. - - - Please note that manually acknowledging the interaction with a message reply will not provide any return data. - Automatically acknowledging the interaction without sending the message will allow for follow up responses to - be used; follow up responses return the message data sent. - - - Gets or sets the timeout for event handlers, in milliseconds, after which a warning will be logged. @@ -3572,6 +3549,21 @@ + + + Moves the user to the voice channel. + + The user to move. + the channel where the user gets moved to. + A task that represents the asynchronous operation for moving a user. + + + + Disconnects the user from its current voice channel + + The user to disconnect. + A task that represents the asynchronous operation for disconnecting a user. + Gets a specific sticker within this guild. @@ -4189,7 +4181,7 @@ Responds to an Interaction with type . - If you have set to , You should use + If you have set to , You should use instead. diff --git a/src/Discord.Net.WebSocket/DiscordSocketClient.cs b/src/Discord.Net.WebSocket/DiscordSocketClient.cs index 007e9f68a..2b9ac9ff8 100644 --- a/src/Discord.Net.WebSocket/DiscordSocketClient.cs +++ b/src/Discord.Net.WebSocket/DiscordSocketClient.cs @@ -72,8 +72,6 @@ namespace Discord.WebSocket internal WebSocketProvider WebSocketProvider { get; private set; } internal bool AlwaysDownloadUsers { get; private set; } internal int? HandlerTimeout { get; private set; } - internal bool AlwaysAcknowledgeInteractions { get; private set; } - internal new DiscordSocketApiClient ApiClient => base.ApiClient as DiscordSocketApiClient; /// public override IReadOnlyCollection Guilds => State.Guilds; @@ -143,7 +141,6 @@ namespace Discord.WebSocket UdpSocketProvider = config.UdpSocketProvider; WebSocketProvider = config.WebSocketProvider; AlwaysDownloadUsers = config.AlwaysDownloadUsers; - AlwaysAcknowledgeInteractions = config.AlwaysAcknowledgeInteractions; HandlerTimeout = config.HandlerTimeout; State = new ClientState(0, 0); Rest = new DiscordSocketRestClient(config, ApiClient); @@ -2095,9 +2092,6 @@ namespace Discord.WebSocket var interaction = SocketInteraction.Create(this, data, channel as ISocketMessageChannel); - if (this.AlwaysAcknowledgeInteractions) - await interaction.DeferAsync().ConfigureAwait(false); - await TimedInvokeAsync(_interactionCreatedEvent, nameof(InteractionCreated), interaction).ConfigureAwait(false); switch (interaction) diff --git a/src/Discord.Net.WebSocket/DiscordSocketConfig.cs b/src/Discord.Net.WebSocket/DiscordSocketConfig.cs index 6ce9489f6..22a201c67 100644 --- a/src/Discord.Net.WebSocket/DiscordSocketConfig.cs +++ b/src/Discord.Net.WebSocket/DiscordSocketConfig.cs @@ -105,29 +105,6 @@ namespace Discord.WebSocket /// public bool AlwaysDownloadUsers { get; set; } = false; - /// - /// Gets or sets whether or not interactions are acknowledge with source. - /// - /// - /// - /// Discord interactions will not appear in chat until the client responds to them. With this option set to - /// , the client will automatically acknowledge the interaction with . - /// See the docs on - /// responding to interactions for more info. - /// - /// - /// With this option set to , you will have to acknowledge the interaction with - /// . - /// Only after the interaction is acknowledged, the original slash command message will be visible. - /// - /// - /// Please note that manually acknowledging the interaction with a message reply will not provide any return data. - /// Automatically acknowledging the interaction without sending the message will allow for follow up responses to - /// be used; follow up responses return the message data sent. - /// - /// - public bool AlwaysAcknowledgeInteractions { get; set; } = true; - /// /// Gets or sets the timeout for event handlers, in milliseconds, after which a warning will be logged. /// Setting this property to nulldisables this check. diff --git a/src/Discord.Net.WebSocket/Entities/Interaction/Message Components/SocketMessageComponent.cs b/src/Discord.Net.WebSocket/Entities/Interaction/Message Components/SocketMessageComponent.cs index 2a3ee4ba3..5daffc2cd 100644 --- a/src/Discord.Net.WebSocket/Entities/Interaction/Message Components/SocketMessageComponent.cs +++ b/src/Discord.Net.WebSocket/Entities/Interaction/Message Components/SocketMessageComponent.cs @@ -86,12 +86,6 @@ namespace Discord.WebSocket if (embeds == null && embed != null) embeds = new[] { embed }; - if (Discord.AlwaysAcknowledgeInteractions) - { - await FollowupAsync(text, embeds, isTTS, ephemeral, allowedMentions, options); - return; - } - Preconditions.AtMost(allowedMentions?.RoleIds?.Count ?? 0, 100, nameof(allowedMentions.RoleIds), "A max of 100 role Ids are allowed."); Preconditions.AtMost(allowedMentions?.UserIds?.Count ?? 0, 100, nameof(allowedMentions.UserIds), "A max of 100 user Ids are allowed."); Preconditions.AtMost(embeds?.Length ?? 0, 10, nameof(embeds), "A max of 10 embeds are allowed."); @@ -341,7 +335,7 @@ namespace Discord.WebSocket }; - return Discord.Rest.ApiClient.CreateInteractionResponse(response, this.Id, this.Token, options); + return Discord.Rest.ApiClient.CreateInteractionResponseAsync(response, this.Id, this.Token, options); } /// @@ -354,7 +348,7 @@ namespace Discord.WebSocket }; - return Discord.Rest.ApiClient.CreateInteractionResponse(response, this.Id, this.Token, options); + return Discord.Rest.ApiClient.CreateInteractionResponseAsync(response, this.Id, this.Token, options); } } } diff --git a/src/Discord.Net.WebSocket/Entities/Interaction/SocketBaseCommand/SocketCommandBase.cs b/src/Discord.Net.WebSocket/Entities/Interaction/SocketBaseCommand/SocketCommandBase.cs index 4161a8473..c65048a34 100644 --- a/src/Discord.Net.WebSocket/Entities/Interaction/SocketBaseCommand/SocketCommandBase.cs +++ b/src/Discord.Net.WebSocket/Entities/Interaction/SocketBaseCommand/SocketCommandBase.cs @@ -70,12 +70,6 @@ namespace Discord.WebSocket if (embeds == null && embed != null) embeds = new[] { embed }; - if (Discord.AlwaysAcknowledgeInteractions) - { - await FollowupAsync(text, embeds, isTTS, ephemeral, allowedMentions, options, component); - return; - } - Preconditions.AtMost(allowedMentions?.RoleIds?.Count ?? 0, 100, nameof(allowedMentions.RoleIds), "A max of 100 role Ids are allowed."); Preconditions.AtMost(allowedMentions?.UserIds?.Count ?? 0, 100, nameof(allowedMentions.UserIds), "A max of 100 user Ids are allowed."); Preconditions.AtMost(embeds?.Length ?? 0, 10, nameof(embeds), "A max of 10 embeds are allowed."); @@ -244,7 +238,7 @@ namespace Discord.WebSocket } }; - return Discord.Rest.ApiClient.CreateInteractionResponse(response, this.Id, this.Token, options); + return Discord.Rest.ApiClient.CreateInteractionResponseAsync(response, this.Id, this.Token, options); } } }