From 6039378c52b38a2ae53bd012643d94e84091cebd Mon Sep 17 00:00:00 2001 From: Armano den Boef <68127614+Rozen4334@users.noreply.github.com> Date: Wed, 16 Feb 2022 12:51:15 +0100 Subject: [PATCH] Fixes unused creation of REST clients for DiscordShardedClient shards. (#2109) * Init * Remove unnecessary length check * Swap out for any check * Final; Check if parentclient was passed --- src/Discord.Net.WebSocket/DiscordSocketClient.cs | 3 ++- 1 file changed, 2 insertions(+), 1 deletion(-) diff --git a/src/Discord.Net.WebSocket/DiscordSocketClient.cs b/src/Discord.Net.WebSocket/DiscordSocketClient.cs index b0215d9ef..ecd53cf65 100644 --- a/src/Discord.Net.WebSocket/DiscordSocketClient.cs +++ b/src/Discord.Net.WebSocket/DiscordSocketClient.cs @@ -152,7 +152,8 @@ namespace Discord.WebSocket LogGatewayIntentWarnings = config.LogGatewayIntentWarnings; HandlerTimeout = config.HandlerTimeout; State = new ClientState(0, 0); - Rest = new DiscordSocketRestClient(config, ApiClient); + if (shardedClient is null || parentClient is null) + Rest = new DiscordSocketRestClient(config, ApiClient); _heartbeatTimes = new ConcurrentQueue(); _gatewayIntents = config.GatewayIntents; _defaultStickers = ImmutableArray.Create>();