Browse Source

Further amendment based on review

pull/1022/head
HelpfulStranger999 8 years ago
parent
commit
e819eace34
2 changed files with 5 additions and 5 deletions
  1. +2
    -2
      src/Discord.Net.Rest/DiscordRestApiClient.cs
  2. +3
    -3
      src/Discord.Net.Rest/Entities/Messages/MessageHelper.cs

+ 2
- 2
src/Discord.Net.Rest/DiscordRestApiClient.cs View File

@@ -622,8 +622,8 @@ namespace Discord.API
Preconditions.GreaterThan(args.AfterUserId, 0, nameof(args.AfterUserId)); Preconditions.GreaterThan(args.AfterUserId, 0, nameof(args.AfterUserId));
options = RequestOptions.CreateOrClone(options); options = RequestOptions.CreateOrClone(options);


var limit = args.Limit.GetValueOrDefault(DiscordConfig.MaxUserReactionsPerBatch);
var afterUserId = args.AfterUserId.GetValueOrDefault(0);
int limit = args.Limit.GetValueOrDefault(DiscordConfig.MaxUserReactionsPerBatch);
ulong afterUserId = args.AfterUserId.GetValueOrDefault(0);


var ids = new BucketIds(channelId: channelId); var ids = new BucketIds(channelId: channelId);
Expression<Func<string>> endpoint = () => $"channels/{channelId}/messages/{messageId}/reactions/{emoji}?limit={limit}&after={afterUserId}"; Expression<Func<string>> endpoint = () => $"channels/{channelId}/messages/{messageId}/reactions/{emoji}?limit={limit}&after={afterUserId}";


+ 3
- 3
src/Discord.Net.Rest/Entities/Messages/MessageHelper.cs View File

@@ -60,7 +60,7 @@ namespace Discord.Rest
async (info, ct) => async (info, ct) =>
{ {
var args = new GetReactionUsersParams(); var args = new GetReactionUsersParams();
func(args);
args.Limit = info.PageSize;


if (info.Position != null) if (info.Position != null)
args.AfterUserId = info.Position.Value; args.AfterUserId = info.Position.Value;
@@ -81,8 +81,8 @@ namespace Discord.Rest
info.Position = lastPage.Max(x => x.Id); info.Position = lastPage.Max(x => x.Id);
return true; return true;
}, },
start: arguments.AfterUserId.Value,
count: arguments.Limit.Value
start: arguments.AfterUserId.IsSpecified ? arguments.AfterUserId.Value : (ulong?)null,
count: arguments.Limit.GetValueOrDefault(DiscordConfig.MaxUserReactionsPerBatch)
); );


} }


Loading…
Cancel
Save