public static Task <IReadOnlyList <IUser> > FetchReactionsAsync(this IRestClient client, Snowflake channelId, Snowflake messageId, LocalEmoji emoji, int limit = Discord.Limits.Rest.FetchReactionsPageSize, Snowflake?startFromId = null, IRestRequestOptions options = null, CancellationToken cancellationToken = default) { Guard.IsNotNull(emoji); if (limit == 0) { return(Task.FromResult(ReadOnlyList <IUser> .Empty)); } if (limit <= Discord.Limits.Rest.FetchReactionsPageSize) { return(client.InternalFetchReactionsAsync(channelId, messageId, emoji, limit, startFromId, options, cancellationToken)); } var enumerable = client.EnumerateReactions(channelId, messageId, emoji, limit, startFromId, options); return(enumerable.FlattenAsync(cancellationToken)); }
public static Task <IReadOnlyList <IUser> > FetchReactionsAsync(this IRestClient client, Snowflake channelId, Snowflake messageId, LocalEmoji emoji, int limit = 100, Snowflake?startFromId = null, IRestRequestOptions options = null) { if (emoji == null) { throw new ArgumentNullException(nameof(emoji)); } if (limit == 0) { return(Task.FromResult(ReadOnlyList <IUser> .Empty)); } if (limit <= 100) { return(client.InternalFetchReactionsAsync(channelId, messageId, emoji, limit, startFromId, options)); } var enumerable = client.EnumerateReactions(channelId, messageId, emoji, limit, startFromId, options); return(enumerable.FlattenAsync()); }