diff --git a/src/Discord.Net.Rest/Entities/Channels/RestThreadChannel.cs b/src/Discord.Net.Rest/Entities/Channels/RestThreadChannel.cs index 4f3b0506c..f9f8c037a 100644 --- a/src/Discord.Net.Rest/Entities/Channels/RestThreadChannel.cs +++ b/src/Discord.Net.Rest/Entities/Channels/RestThreadChannel.cs @@ -104,12 +104,24 @@ namespace Discord.Rest /// /// Gets a collection of users within this thread. /// + /// Sets the limit of the user count for each request. 100 by default. /// /// A task that represents the asynchronous get operation. The task result contains a collection of thread /// users found within this thread channel. /// - public IAsyncEnumerable> GetUsersAsync(int usersPerBatch = DiscordConfig.MaxThreadMembersPerBatch, RequestOptions options = null) - => ThreadHelper.GetUsersAsync(this, Discord, usersPerBatch, null, options); + public IAsyncEnumerable> GetThreadUsersAsync(int limit = DiscordConfig.MaxThreadMembersPerBatch, RequestOptions options = null) + => ThreadHelper.GetUsersAsync(this, Discord, limit, null, options); + + /// + /// Gets a collection of users within this thread. + /// + /// The options to be used when sending the request. + /// + /// A task representing the asynchronous get operation. The task returns a + /// of 's. + /// + public new async Task> GetUsersAsync(RequestOptions options = null) + => (await GetThreadUsersAsync(options: options).FlattenAsync()).ToImmutableArray(); /// public override async Task ModifyAsync(Action func, RequestOptions options = null) diff --git a/src/Discord.Net.Rest/Entities/Channels/ThreadHelper.cs b/src/Discord.Net.Rest/Entities/Channels/ThreadHelper.cs index 76d0f504d..7b6d42e22 100644 --- a/src/Discord.Net.Rest/Entities/Channels/ThreadHelper.cs +++ b/src/Discord.Net.Rest/Entities/Channels/ThreadHelper.cs @@ -85,10 +85,10 @@ namespace Discord.Rest return result.Threads.Select(x => RestThreadChannel.Create(client, channel.Guild, x)).ToImmutableArray(); } - public static IAsyncEnumerable> GetUsersAsync(IThreadChannel channel, BaseDiscordClient client, int? limit = null, ulong? afterId = null, RequestOptions options = null) + public static IAsyncEnumerable> GetUsersAsync(IThreadChannel channel, BaseDiscordClient client, int limit = DiscordConfig.MaxThreadMembersPerBatch, ulong? afterId = null, RequestOptions options = null) { return new PagedAsyncEnumerable( - DiscordConfig.MaxUsersPerBatch, + limit, async (info, ct) => { if (info.Position != null)