Browse Source

return & update old method

pull/2580/head
Misha133 2 years ago
parent
commit
a04e0d9519
2 changed files with 16 additions and 4 deletions
  1. +14
    -2
      src/Discord.Net.Rest/Entities/Channels/RestThreadChannel.cs
  2. +2
    -2
      src/Discord.Net.Rest/Entities/Channels/ThreadHelper.cs

+ 14
- 2
src/Discord.Net.Rest/Entities/Channels/RestThreadChannel.cs View File

@@ -104,12 +104,24 @@ namespace Discord.Rest
/// <summary>
/// Gets a collection of users within this thread.
/// </summary>
/// <param name="limit">Sets the limit of the user count for each request. 100 by default.</param>
/// <returns>
/// A task that represents the asynchronous get operation. The task result contains a collection of thread
/// users found within this thread channel.
/// </returns>
public IAsyncEnumerable<IReadOnlyCollection<RestThreadUser>> GetUsersAsync(int usersPerBatch = DiscordConfig.MaxThreadMembersPerBatch, RequestOptions options = null)
=> ThreadHelper.GetUsersAsync(this, Discord, usersPerBatch, null, options);
public IAsyncEnumerable<IReadOnlyCollection<RestThreadUser>> GetThreadUsersAsync(int limit = DiscordConfig.MaxThreadMembersPerBatch, RequestOptions options = null)
=> ThreadHelper.GetUsersAsync(this, Discord, limit, null, options);

/// <summary>
/// Gets a collection of users within this thread.
/// </summary>
/// <param name="options">The options to be used when sending the request.</param>
/// <returns>
/// A task representing the asynchronous get operation. The task returns a
/// <see cref="IReadOnlyCollection{T}"/> of <see cref="RestThreadUser"/>'s.
/// </returns>
public new async Task<IReadOnlyCollection<RestThreadUser>> GetUsersAsync(RequestOptions options = null)
=> (await GetThreadUsersAsync(options: options).FlattenAsync()).ToImmutableArray();

/// <inheritdoc/>
public override async Task ModifyAsync(Action<TextChannelProperties> func, RequestOptions options = null)


+ 2
- 2
src/Discord.Net.Rest/Entities/Channels/ThreadHelper.cs View File

@@ -85,10 +85,10 @@ namespace Discord.Rest
return result.Threads.Select(x => RestThreadChannel.Create(client, channel.Guild, x)).ToImmutableArray();
}

public static IAsyncEnumerable<IReadOnlyCollection<RestThreadUser>> GetUsersAsync(IThreadChannel channel, BaseDiscordClient client, int? limit = null, ulong? afterId = null, RequestOptions options = null)
public static IAsyncEnumerable<IReadOnlyCollection<RestThreadUser>> GetUsersAsync(IThreadChannel channel, BaseDiscordClient client, int limit = DiscordConfig.MaxThreadMembersPerBatch, ulong? afterId = null, RequestOptions options = null)
{
return new PagedAsyncEnumerable<RestThreadUser>(
DiscordConfig.MaxUsersPerBatch,
limit,
async (info, ct) =>
{
if (info.Position != null)


Loading…
Cancel
Save