diff --git a/src/Discord.Net.Core/Entities/Messages/IMessage.cs b/src/Discord.Net.Core/Entities/Messages/IMessage.cs
index 05f505269..a42eb5e47 100644
--- a/src/Discord.Net.Core/Entities/Messages/IMessage.cs
+++ b/src/Discord.Net.Core/Entities/Messages/IMessage.cs
@@ -216,6 +216,16 @@ namespace Discord
///
Task RemoveAllReactionsAsync(RequestOptions options = null);
+ ///
+ /// Removes all reactions of a given emote in the message.
+ ///
+ /// The emote to clear.
+ /// The options to be used when sending the request.
+ ///
+ /// A task that represents the asyncronous removal operation.
+ ///
+ Task RemoveEmojiReactionsAsync(IEmote emote, RequestOptions options = null);
+
///
/// Gets all users that reacted to a message with a given emote.
///
diff --git a/src/Discord.Net.Rest/DiscordRestApiClient.cs b/src/Discord.Net.Rest/DiscordRestApiClient.cs
index ff6d17240..bb92bb313 100644
--- a/src/Discord.Net.Rest/DiscordRestApiClient.cs
+++ b/src/Discord.Net.Rest/DiscordRestApiClient.cs
@@ -665,6 +665,19 @@ namespace Discord.API
await SendAsync("DELETE", () => $"channels/{channelId}/messages/{messageId}/reactions", ids, options: options).ConfigureAwait(false);
}
+
+ public async Task RemoveEmojiReactionsAsync(ulong channelId, ulong messageId, string emoji, 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/{emoji}", ids, options: options);
+ }
+
public async Task> GetReactionUsersAsync(ulong channelId, ulong messageId, string emoji, GetReactionUsersParams args, RequestOptions options = null)
{
Preconditions.NotEqual(channelId, 0, nameof(channelId));
diff --git a/src/Discord.Net.Rest/Entities/Messages/MessageHelper.cs b/src/Discord.Net.Rest/Entities/Messages/MessageHelper.cs
index 75892defb..f1c1c95d2 100644
--- a/src/Discord.Net.Rest/Entities/Messages/MessageHelper.cs
+++ b/src/Discord.Net.Rest/Entities/Messages/MessageHelper.cs
@@ -71,6 +71,11 @@ namespace Discord.Rest
await client.ApiClient.RemoveAllReactionsAsync(msg.Channel.Id, msg.Id, options).ConfigureAwait(false);
}
+ public static async Task RemoveEmojiReactionsAsync(IMessage msg, IEmote emote, BaseDiscordClient client, RequestOptions options)
+ {
+ await client.ApiClient.RemoveEmojiReactionsAsync(msg.Channel.Id, msg.Id, emote is Emote e ? $"{e.Name}:{e.Id}" : emote.Name, options).ConfigureAwait(false);
+ }
+
public static IAsyncEnumerable> GetReactionUsersAsync(IMessage msg, IEmote emote,
int? limit, BaseDiscordClient client, RequestOptions options)
{
diff --git a/src/Discord.Net.Rest/Entities/Messages/RestMessage.cs b/src/Discord.Net.Rest/Entities/Messages/RestMessage.cs
index f457f4f7a..11c04610d 100644
--- a/src/Discord.Net.Rest/Entities/Messages/RestMessage.cs
+++ b/src/Discord.Net.Rest/Entities/Messages/RestMessage.cs
@@ -182,6 +182,9 @@ namespace Discord.Rest
public Task RemoveAllReactionsAsync(RequestOptions options = null)
=> MessageHelper.RemoveAllReactionsAsync(this, Discord, options);
///
+ public Task RemoveEmojiReactionsAsync(IEmote emote, RequestOptions options = null)
+ => MessageHelper.RemoveEmojiReactionsAsync(this, emote, Discord, options);
+ ///
public IAsyncEnumerable> GetReactionUsersAsync(IEmote emote, int limit, RequestOptions options = null)
=> MessageHelper.GetReactionUsersAsync(this, emote, limit, Discord, options);
}
diff --git a/src/Discord.Net.WebSocket/BaseSocketClient.Events.cs b/src/Discord.Net.WebSocket/BaseSocketClient.Events.cs
index 24c5c7c51..43c16f945 100644
--- a/src/Discord.Net.WebSocket/BaseSocketClient.Events.cs
+++ b/src/Discord.Net.WebSocket/BaseSocketClient.Events.cs
@@ -236,11 +236,11 @@ namespace Discord.WebSocket
internal readonly AsyncEvent, ISocketMessageChannel, Task>> _reactionsClearedEvent = new AsyncEvent, ISocketMessageChannel, Task>>();
/// Fired when all reactions of a specific reaction are removed.
- public event Func, ISocketMessageChannel, SocketReaction, Task> ReactionsClearedEmoji {
- add { _reactionsClearedEmojiEvent.Add(value); }
- remove { _reactionsClearedEmojiEvent.Remove(value); }
+ public event Func, ISocketMessageChannel, SocketReaction, Task> RemovedEmojiReactions {
+ add { _removedEmojiReactionsEvent.Add(value); }
+ remove { _removedEmojiReactionsEvent.Remove(value); }
}
- internal readonly AsyncEvent, ISocketMessageChannel, SocketReaction, Task>> _reactionsClearedEmojiEvent = new AsyncEvent, ISocketMessageChannel, SocketReaction, Task>>();
+ internal readonly AsyncEvent, ISocketMessageChannel, SocketReaction, Task>> _removedEmojiReactionsEvent = new AsyncEvent, ISocketMessageChannel, SocketReaction, Task>>();
//Roles
diff --git a/src/Discord.Net.WebSocket/DiscordShardedClient.cs b/src/Discord.Net.WebSocket/DiscordShardedClient.cs
index 15b2e6536..23ef1406f 100644
--- a/src/Discord.Net.WebSocket/DiscordShardedClient.cs
+++ b/src/Discord.Net.WebSocket/DiscordShardedClient.cs
@@ -313,7 +313,7 @@ namespace Discord.WebSocket
client.ReactionAdded += (cache, channel, reaction) => _reactionAddedEvent.InvokeAsync(cache, channel, reaction);
client.ReactionRemoved += (cache, channel, reaction) => _reactionRemovedEvent.InvokeAsync(cache, channel, reaction);
client.ReactionsCleared += (cache, channel) => _reactionsClearedEvent.InvokeAsync(cache, channel);
- client.ReactionsClearedEmoji += (cache, channel, reaction) => _reactionsClearedEmojiEvent.InvokeAsync(cache, channel, reaction);
+ client.RemovedEmojiReactions += (cache, channel, reaction) => _removedEmojiReactionsEvent.InvokeAsync(cache, channel, reaction);
client.RoleCreated += (role) => _roleCreatedEvent.InvokeAsync(role);
client.RoleDeleted += (role) => _roleDeletedEvent.InvokeAsync(role);
diff --git a/src/Discord.Net.WebSocket/DiscordSocketClient.cs b/src/Discord.Net.WebSocket/DiscordSocketClient.cs
index ae2856044..185414bc1 100644
--- a/src/Discord.Net.WebSocket/DiscordSocketClient.cs
+++ b/src/Discord.Net.WebSocket/DiscordSocketClient.cs
@@ -1401,7 +1401,7 @@ namespace Discord.WebSocket
cachedMsg?.ClearReactionsEmoji(reaction);
- await TimedInvokeAsync(_reactionsClearedEmojiEvent, nameof(ReactionsClearedEmoji), cacheable, channel, reaction).ConfigureAwait(false);
+ await TimedInvokeAsync(_removedEmojiReactionsEvent, nameof(RemovedEmojiReactions), cacheable, channel, reaction).ConfigureAwait(false);
}
else
{
diff --git a/src/Discord.Net.WebSocket/Entities/Invites/SocketInvite.cs b/src/Discord.Net.WebSocket/Entities/Invites/SocketInvite.cs
index 1d0d77c29..7da19077b 100644
--- a/src/Discord.Net.WebSocket/Entities/Invites/SocketInvite.cs
+++ b/src/Discord.Net.WebSocket/Entities/Invites/SocketInvite.cs
@@ -7,29 +7,65 @@ using Model = Discord.API.InviteEvent;
namespace Discord.WebSocket
{
+ ///
+ /// Represents a WebSocket-based invite.
+ ///
public class SocketInvite : SocketEntity
{
+ ///
+ /// Gets the channel in which this invite was created.
+ ///
public ISocketMessageChannel Channel { get; private set; }
+ ///
+ /// Gets the channel ID in which this invite was created.
+ ///
public ulong ChannelId { get; private set; }
+ ///
+ /// Gets the guild in which this invite was created.
+ ///
public IGuild Guild { get; private set; }
+ ///
+ /// Gets the guild ID in which this invite was created.
+ ///
public ulong GuildId { get; private set; }
+ ///
+ /// Gets the unique identifier for this invite.
+ ///
public string Code { get; private set; }
- public SocketUser Inviter { get; private set; }
+ ///
+ /// Gets the user who created this invite.
+ ///
+ public Optional Inviter { get; private set; }
- public DateTimeOffset CreatedAt { get; private set; }
+ ///
+ /// Gets when this invite was created.
+ ///
+ public Optional CreatedAt { get; private set; }
- public int MaxAge { get; private set; }
+ ///
+ /// Gets the time (in seconds) until the invite expires.
+ ///
+ public Optional MaxAge { get; private set; }
- public int MaxUses { get; private set; }
+ ///
+ /// Gets the max number of uses this invite may have.
+ ///
+ public Optional MaxUses { get; private set; }
- public int Uses { get; set; }
+ ///
+ /// Gets the number of times this invite has been used.
+ ///
+ public Optional Uses { get; set; }
- public bool Temporary { get; private set; }
+ ///
+ /// Gets a value that indicates whether the invite is a temporary one.
+ ///
+ public Optional IsTemporary { get; private set; }
internal SocketInvite(DiscordSocketClient discord, Model model)
: base(discord, model.Code)
@@ -62,7 +98,7 @@ namespace Discord.WebSocket
MaxAge = model.MaxAge.Value;
MaxUses = model.MaxUses.Value;
Uses = model.Uses.Value;
- Temporary = model.Temporary;
+ IsTemporary = model.Temporary;
}
internal void Update(string code, IGuild guild, ISocketMessageChannel channel)
diff --git a/src/Discord.Net.WebSocket/Entities/Messages/SocketMessage.cs b/src/Discord.Net.WebSocket/Entities/Messages/SocketMessage.cs
index b472e063a..e3eb01389 100644
--- a/src/Discord.Net.WebSocket/Entities/Messages/SocketMessage.cs
+++ b/src/Discord.Net.WebSocket/Entities/Messages/SocketMessage.cs
@@ -215,6 +215,9 @@ namespace Discord.WebSocket
public Task RemoveAllReactionsAsync(RequestOptions options = null)
=> MessageHelper.RemoveAllReactionsAsync(this, Discord, options);
///
+ public Task RemoveEmojiReactionsAsync(IEmote emote, RequestOptions options = null)
+ => MessageHelper.RemoveEmojiReactionsAsync(this, emote, Discord, options);
+ ///
public IAsyncEnumerable> GetReactionUsersAsync(IEmote emote, int limit, RequestOptions options = null)
=> MessageHelper.GetReactionUsersAsync(this, emote, limit, Discord, options);
}