@@ -536,6 +536,17 @@ namespace Discord.API | |||||
await SendAsync("DELETE", () => $"channels/{channelId}/messages/{messageId}/reactions/{emoji}/{userId}", ids, options: options).ConfigureAwait(false); | await SendAsync("DELETE", () => $"channels/{channelId}/messages/{messageId}/reactions/{emoji}/{userId}", ids, options: options).ConfigureAwait(false); | ||||
} | } | ||||
public async Task RemoveAllReactionsAsync(ulong channelId, ulong messageId, RequestOptions options = null) | |||||
{ | |||||
Preconditions.NotEqual(channelId, 0, nameof(channelId)); | |||||
Preconditions.NotEqual(messageId, 0, nameof(messageId)); | |||||
options = RequestOptions.CreateOrClone(options); | |||||
var ids = new BucketIds(channelId: channelId); | |||||
await SendAsync("DELETE", () => $"channels/{channelId}/messages/{messageId}/reactions", ids, options: options).ConfigureAwait(false); | |||||
} | |||||
public async Task<IReadOnlyCollection<User>> GetReactionUsersAsync(ulong channelId, ulong messageId, string emoji, GetReactionUsersParams args, RequestOptions options = null) | public async Task<IReadOnlyCollection<User>> GetReactionUsersAsync(ulong channelId, ulong messageId, string emoji, GetReactionUsersParams args, RequestOptions options = null) | ||||
{ | { | ||||
Preconditions.NotEqual(channelId, 0, nameof(channelId)); | Preconditions.NotEqual(channelId, 0, nameof(channelId)); | ||||
@@ -25,6 +25,8 @@ namespace Discord | |||||
Task RemoveReactionAsync(Emoji emoji, IUser user, RequestOptions options = null); | Task RemoveReactionAsync(Emoji emoji, IUser user, RequestOptions options = null); | ||||
/// <summary> Removes a reaction from this message. </summary> | /// <summary> Removes a reaction from this message. </summary> | ||||
Task RemoveReactionAsync(string emoji, IUser user, RequestOptions options = null); | Task RemoveReactionAsync(string emoji, IUser user, RequestOptions options = null); | ||||
/// <summary> Removes all reactions from this message. </summary> | |||||
Task RemoveAllReactionsAsync(RequestOptions options = null); | |||||
Task<IReadOnlyCollection<IUser>> GetReactionUsersAsync(string emoji, int limit = 100, ulong? afterUserId = null, RequestOptions options = null); | Task<IReadOnlyCollection<IUser>> GetReactionUsersAsync(string 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> | ||||
@@ -38,6 +38,11 @@ namespace Discord.Rest | |||||
await client.ApiClient.RemoveReactionAsync(msg.Channel.Id, msg.Id, user.Id, emoji, options).ConfigureAwait(false); | await client.ApiClient.RemoveReactionAsync(msg.Channel.Id, msg.Id, user.Id, emoji, options).ConfigureAwait(false); | ||||
} | } | ||||
public static async Task RemoveAllReactionsAsync(IMessage msg, BaseDiscordClient client, RequestOptions 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, string emoji, | ||||
Action<GetReactionUsersParams> func, BaseDiscordClient client, RequestOptions options) | Action<GetReactionUsersParams> func, BaseDiscordClient client, RequestOptions options) | ||||
{ | { | ||||
@@ -142,6 +142,9 @@ namespace Discord.Rest | |||||
=> MessageHelper.RemoveReactionAsync(this, user, emoji, Discord, options); | => MessageHelper.RemoveReactionAsync(this, user, emoji, Discord, options); | ||||
public Task RemoveReactionAsync(string emoji, IUser user, RequestOptions options = null) | public Task RemoveReactionAsync(string emoji, IUser user, RequestOptions options = null) | ||||
=> MessageHelper.RemoveReactionAsync(this, user, emoji, Discord, options); | => MessageHelper.RemoveReactionAsync(this, user, emoji, Discord, options); | ||||
public Task RemoveAllReactionsAsync(RequestOptions options = null) | |||||
=> MessageHelper.RemoveAllReactionsAsync(this, Discord, options); | |||||
public Task<IReadOnlyCollection<IUser>> GetReactionUsersAsync(string emoji, int limit = 100, ulong? afterUserId = null, RequestOptions options = null) | 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); | => MessageHelper.GetReactionUsersAsync(this, emoji, x => { x.Limit = limit; x.AfterUserId = afterUserId.HasValue ? afterUserId.Value : Optional.Create<ulong>(); }, Discord, options); | ||||
@@ -111,6 +111,9 @@ namespace Discord.Rpc | |||||
=> MessageHelper.RemoveReactionAsync(this, user, emoji, Discord, options); | => MessageHelper.RemoveReactionAsync(this, user, emoji, Discord, options); | ||||
public Task RemoveReactionAsync(string emoji, IUser user, RequestOptions options = null) | public Task RemoveReactionAsync(string emoji, IUser user, RequestOptions options = null) | ||||
=> MessageHelper.RemoveReactionAsync(this, user, emoji, Discord, options); | => MessageHelper.RemoveReactionAsync(this, user, emoji, Discord, options); | ||||
public Task RemoveAllReactionsAsync(RequestOptions options = null) | |||||
=> MessageHelper.RemoveAllReactionsAsync(this, Discord, options); | |||||
public Task<IReadOnlyCollection<IUser>> GetReactionUsersAsync(string emoji, int limit, ulong? afterUserId, RequestOptions options = null) | 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); | => MessageHelper.GetReactionUsersAsync(this, emoji, x => { x.Limit = limit; x.AfterUserId = afterUserId.HasValue ? afterUserId.Value : Optional.Create<ulong>(); }, Discord, options); | ||||
@@ -136,6 +136,9 @@ namespace Discord.WebSocket | |||||
public Task RemoveReactionAsync(string emoji, IUser user, RequestOptions options = null) | public Task RemoveReactionAsync(string emoji, IUser user, RequestOptions options = null) | ||||
=> MessageHelper.RemoveReactionAsync(this, user, emoji, Discord, options); | => MessageHelper.RemoveReactionAsync(this, user, emoji, Discord, options); | ||||
public Task RemoveAllReactionsAsync(RequestOptions options = null) | |||||
=> MessageHelper.RemoveAllReactionsAsync(this, Discord, options); | |||||
public Task<IReadOnlyCollection<IUser>> GetReactionUsersAsync(string emoji, int limit = 100, ulong? afterUserId = null, RequestOptions options = null) | 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); | => MessageHelper.GetReactionUsersAsync(this, emoji, x => { x.Limit = limit; x.AfterUserId = afterUserId.HasValue ? afterUserId.Value : Optional.Create<ulong>(); }, Discord, options); | ||||