* Add GetReactionUsersAsync(IEmote) overload Resolves #730 * Remove obsolete GetReactionUsersAsync(string) overloadtags/2.0.0-beta
| @@ -22,7 +22,8 @@ namespace Discord | |||||
| Task RemoveReactionAsync(IEmote emote, IUser user, RequestOptions options = null); | Task RemoveReactionAsync(IEmote emote, IUser user, RequestOptions options = null); | ||||
| /// <summary> Removes all reactions from this message. </summary> | /// <summary> Removes all reactions from this message. </summary> | ||||
| Task RemoveAllReactionsAsync(RequestOptions options = null); | Task RemoveAllReactionsAsync(RequestOptions options = null); | ||||
| Task<IReadOnlyCollection<IUser>> GetReactionUsersAsync(string emoji, int limit = 100, ulong? afterUserId = null, RequestOptions options = null); | |||||
| /// <summary> Gets all users that reacted to a message with a given emote </summary> | |||||
| Task<IReadOnlyCollection<IUser>> GetReactionUsersAsync(IEmote emoji, int limit = 100, ulong? afterUserId = null, RequestOptions options = null); | |||||
| /// <summary> Transforms this message's text into a human readable form by resolving its tags. </summary> | /// <summary> Transforms this message's text into a human readable form by resolving its tags. </summary> | ||||
| string Resolve( | string Resolve( | ||||
| @@ -43,11 +43,12 @@ namespace Discord.Rest | |||||
| await client.ApiClient.RemoveAllReactionsAsync(msg.Channel.Id, msg.Id, options); | await client.ApiClient.RemoveAllReactionsAsync(msg.Channel.Id, msg.Id, options); | ||||
| } | } | ||||
| public static async Task<IReadOnlyCollection<IUser>> GetReactionUsersAsync(IMessage msg, string emoji, | |||||
| public static async Task<IReadOnlyCollection<IUser>> GetReactionUsersAsync(IMessage msg, IEmote emote, | |||||
| Action<GetReactionUsersParams> func, BaseDiscordClient client, RequestOptions options) | Action<GetReactionUsersParams> func, BaseDiscordClient client, RequestOptions options) | ||||
| { | { | ||||
| var args = new GetReactionUsersParams(); | var args = new GetReactionUsersParams(); | ||||
| func(args); | func(args); | ||||
| string emoji = (emote is Emote e ? $"{e.Name}:{e.Id}" : emote.Name); | |||||
| return (await client.ApiClient.GetReactionUsersAsync(msg.Channel.Id, msg.Id, emoji, args, options).ConfigureAwait(false)).Select(u => RestUser.Create(client, u)).ToImmutableArray(); | return (await client.ApiClient.GetReactionUsersAsync(msg.Channel.Id, msg.Id, emoji, args, options).ConfigureAwait(false)).Select(u => RestUser.Create(client, u)).ToImmutableArray(); | ||||
| } | } | ||||
| @@ -136,10 +136,9 @@ namespace Discord.Rest | |||||
| => MessageHelper.RemoveReactionAsync(this, user, emote, Discord, options); | => MessageHelper.RemoveReactionAsync(this, user, emote, Discord, options); | ||||
| public Task RemoveAllReactionsAsync(RequestOptions options = null) | public Task RemoveAllReactionsAsync(RequestOptions options = null) | ||||
| => MessageHelper.RemoveAllReactionsAsync(this, Discord, options); | => MessageHelper.RemoveAllReactionsAsync(this, Discord, options); | ||||
| public Task<IReadOnlyCollection<IUser>> GetReactionUsersAsync(string emoji, int limit = 100, ulong? afterUserId = null, RequestOptions options = null) | |||||
| => MessageHelper.GetReactionUsersAsync(this, emoji, x => { x.Limit = limit; x.AfterUserId = afterUserId ?? Optional.Create<ulong>(); }, Discord, options); | |||||
| public Task<IReadOnlyCollection<IUser>> GetReactionUsersAsync(IEmote emote, int limit = 100, ulong? afterUserId = null, RequestOptions options = null) | |||||
| => MessageHelper.GetReactionUsersAsync(this, emote, x => { x.Limit = limit; x.AfterUserId = afterUserId ?? Optional.Create<ulong>(); }, Discord, options); | |||||
| public Task PinAsync(RequestOptions options = null) | public Task PinAsync(RequestOptions options = null) | ||||
| => MessageHelper.PinAsync(this, Discord, options); | => MessageHelper.PinAsync(this, Discord, options); | ||||
| @@ -108,9 +108,8 @@ namespace Discord.Rpc | |||||
| => MessageHelper.RemoveReactionAsync(this, user, emote, Discord, options); | => MessageHelper.RemoveReactionAsync(this, user, emote, Discord, options); | ||||
| public Task RemoveAllReactionsAsync(RequestOptions options = null) | public Task RemoveAllReactionsAsync(RequestOptions options = null) | ||||
| => MessageHelper.RemoveAllReactionsAsync(this, Discord, options); | => MessageHelper.RemoveAllReactionsAsync(this, Discord, options); | ||||
| public Task<IReadOnlyCollection<IUser>> GetReactionUsersAsync(string emoji, int limit, ulong? afterUserId, RequestOptions options = null) | |||||
| => MessageHelper.GetReactionUsersAsync(this, emoji, x => { x.Limit = limit; x.AfterUserId = afterUserId.HasValue ? afterUserId.Value : Optional.Create<ulong>(); }, Discord, options); | |||||
| public Task<IReadOnlyCollection<IUser>> GetReactionUsersAsync(IEmote emote, int limit = 100, ulong? afterUserId = null, RequestOptions options = null) | |||||
| => MessageHelper.GetReactionUsersAsync(this, emote, x => { x.Limit = limit; x.AfterUserId = afterUserId ?? Optional.Create<ulong>(); }, Discord, options); | |||||
| public Task PinAsync(RequestOptions options) | public Task PinAsync(RequestOptions options) | ||||
| => MessageHelper.PinAsync(this, Discord, options); | => MessageHelper.PinAsync(this, Discord, options); | ||||
| @@ -130,9 +130,8 @@ namespace Discord.WebSocket | |||||
| => MessageHelper.RemoveReactionAsync(this, user, emote, Discord, options); | => MessageHelper.RemoveReactionAsync(this, user, emote, Discord, options); | ||||
| public Task RemoveAllReactionsAsync(RequestOptions options = null) | public Task RemoveAllReactionsAsync(RequestOptions options = null) | ||||
| => MessageHelper.RemoveAllReactionsAsync(this, Discord, options); | => MessageHelper.RemoveAllReactionsAsync(this, Discord, options); | ||||
| public Task<IReadOnlyCollection<IUser>> GetReactionUsersAsync(string emoji, int limit = 100, ulong? afterUserId = null, RequestOptions options = null) | |||||
| => MessageHelper.GetReactionUsersAsync(this, emoji, x => { x.Limit = limit; x.AfterUserId = afterUserId.HasValue ? afterUserId.Value : Optional.Create<ulong>(); }, Discord, options); | |||||
| public Task<IReadOnlyCollection<IUser>> GetReactionUsersAsync(IEmote emote, int limit = 100, ulong? afterUserId = null, RequestOptions options = null) | |||||
| => MessageHelper.GetReactionUsersAsync(this, emote, x => { x.Limit = limit; x.AfterUserId = afterUserId ?? Optional.Create<ulong>(); }, Discord, options); | |||||
| public Task PinAsync(RequestOptions options = null) | public Task PinAsync(RequestOptions options = null) | ||||
| => MessageHelper.PinAsync(this, Discord, options); | => MessageHelper.PinAsync(this, Discord, options); | ||||