From 448978a985fb742d6229c161c5c09974256fae28 Mon Sep 17 00:00:00 2001 From: quin lynch Date: Thu, 5 Aug 2021 15:46:21 -0300 Subject: [PATCH] Fix bucketing #82 --- src/Discord.Net.Rest/DiscordRestApiClient.cs | 15 ++++++++++----- 1 file changed, 10 insertions(+), 5 deletions(-) diff --git a/src/Discord.Net.Rest/DiscordRestApiClient.cs b/src/Discord.Net.Rest/DiscordRestApiClient.cs index 99c2dadad..e8565b678 100644 --- a/src/Discord.Net.Rest/DiscordRestApiClient.cs +++ b/src/Discord.Net.Rest/DiscordRestApiClient.cs @@ -442,7 +442,7 @@ namespace Discord.API options = RequestOptions.CreateOrClone(options); - var bucket = new BucketIds(0, channelId); + var bucket = new BucketIds(channelId: channelId); return await SendJsonAsync("POST", () => $"channels/{channelId}/threads", args, bucket, options: options).ConfigureAwait(false); } @@ -453,7 +453,9 @@ namespace Discord.API options = RequestOptions.CreateOrClone(options); - await SendAsync("PUT", $"channels/{channelId}/thread-members/@me", options: options).ConfigureAwait(false); + var bucket = new BucketIds(channelId: channelId); + + await SendAsync("PUT", () => $"channels/{channelId}/thread-members/@me", bucket, options: options).ConfigureAwait(false); } public async Task AddThreadMemberAsync(ulong channelId, ulong userId, RequestOptions options = null) @@ -474,7 +476,9 @@ namespace Discord.API options = RequestOptions.CreateOrClone(options); - await SendAsync("DELETE", $"channels/{channelId}/thread-members/@me", options: options).ConfigureAwait(false); + var bucket = new BucketIds(channelId: channelId); + + await SendAsync("DELETE", () => $"channels/{channelId}/thread-members/@me", bucket, options: options).ConfigureAwait(false); } public async Task RemoveThreadMemberAsync(ulong channelId, ulong userId, RequestOptions options = null) @@ -483,8 +487,9 @@ namespace Discord.API Preconditions.NotEqual(userId, 0, nameof(channelId)); options = RequestOptions.CreateOrClone(options); + var bucket = new BucketIds(channelId: channelId); - await SendAsync("DELETE", $"channels/{channelId}/thread-members/{userId}", options: options).ConfigureAwait(false); + await SendAsync("DELETE", () => $"channels/{channelId}/thread-members/{userId}", bucket, options: options).ConfigureAwait(false); } public async Task ListThreadMembersAsync(ulong channelId, RequestOptions options = null) @@ -506,7 +511,7 @@ namespace Discord.API var bucket = new BucketIds(channelId: channelId); - return await SendAsync("GET", $"channels/{channelId}/threads/active"); + return await SendAsync("GET", () => $"channels/{channelId}/threads/active", bucket); } public async Task GetPublicArchivedThreadsAsync(ulong channelId, DateTimeOffset? before = null, int? limit = null, RequestOptions options = null)