diff --git a/src/Discord.Net.Core/Entities/Messages/IReactionMessage.cs b/src/Discord.Net.Core/Entities/Messages/IReactionMessage.cs new file mode 100644 index 000000000..1adbcd5bf --- /dev/null +++ b/src/Discord.Net.Core/Entities/Messages/IReactionMessage.cs @@ -0,0 +1,98 @@ +using System; +using System.Collections.Generic; +using System.Linq; +using System.Text; +using System.Threading.Tasks; + +namespace Discord +{ + /// + /// Represents a message that can be reacted to. + /// + public interface IReactionMessage : IMessage + { + /// + /// Gets all reactions included in this message. + /// + IReadOnlyDictionary Reactions { get; } + + /// + /// Adds a reaction to this message. + /// + /// + /// The following example adds the reaction, 💕, to the message. + /// + /// await msg.AddReactionAsync(new Emoji("\U0001f495")); + /// + /// + /// The emoji used to react to this message. + /// The options to be used when sending the request. + /// + /// A task that represents the asynchronous operation for adding a reaction to this message. + /// + /// + Task AddReactionAsync(IEmote emote, RequestOptions options = null); + /// + /// Removes a reaction from message. + /// + /// + /// The following example removes the reaction, 💕, added by the message author from the message. + /// + /// await msg.RemoveReactionAsync(new Emoji("\U0001f495"), msg.Author); + /// + /// + /// The emoji used to react to this message. + /// The user that added the emoji. + /// The options to be used when sending the request. + /// + /// A task that represents the asynchronous operation for removing a reaction to this message. + /// + /// + Task RemoveReactionAsync(IEmote emote, IUser user, RequestOptions options = null); + /// + /// Removes a reaction from message. + /// + /// + /// The following example removes the reaction, 💕, added by the user with ID 84291986575613952 from the message. + /// + /// await msg.RemoveReactionAsync(new Emoji("\U0001f495"), 84291986575613952); + /// + /// + /// The emoji used to react to this message. + /// The ID of the user that added the emoji. + /// The options to be used when sending the request. + /// + /// A task that represents the asynchronous operation for removing a reaction to this message. + /// + /// + Task RemoveReactionAsync(IEmote emote, ulong userId, RequestOptions options = null); + /// + /// Removes all reactions from this message. + /// + /// The options to be used when sending the request. + /// + /// A task that represents the asynchronous removal operation. + /// + Task RemoveAllReactionsAsync(RequestOptions options = null); + + /// + /// Gets all users that reacted to a message with a given emote. + /// + /// + /// The following example gets the users that have reacted with the emoji 💕 to the message. + /// + /// var emoji = new Emoji("\U0001f495"); + /// var reactedUsers = await message.GetReactionUsersAsync(emoji, 100).FlattenAsync(); + /// + /// + /// The emoji that represents the reaction that you wish to get. + /// The number of users to request. + /// The options to be used when sending the request. + /// + /// A paged collection containing a read-only collection of users that has reacted to this message. + /// Flattening the paginated response into a collection of users with + /// is required if you wish to access the users. + /// + IAsyncEnumerable> GetReactionUsersAsync(IEmote emoji, int limit, RequestOptions options = null); + } +} diff --git a/src/Discord.Net.Core/Entities/Messages/ISystemMessage.cs b/src/Discord.Net.Core/Entities/Messages/ISystemMessage.cs index 89cd17a35..fc65139b1 100644 --- a/src/Discord.Net.Core/Entities/Messages/ISystemMessage.cs +++ b/src/Discord.Net.Core/Entities/Messages/ISystemMessage.cs @@ -3,7 +3,7 @@ namespace Discord /// /// Represents a generic message sent by the system. /// - public interface ISystemMessage : IMessage + public interface ISystemMessage : IReactionMessage { } } diff --git a/src/Discord.Net.Core/Entities/Messages/IUserMessage.cs b/src/Discord.Net.Core/Entities/Messages/IUserMessage.cs index 934350aea..c8941e961 100644 --- a/src/Discord.Net.Core/Entities/Messages/IUserMessage.cs +++ b/src/Discord.Net.Core/Entities/Messages/IUserMessage.cs @@ -7,7 +7,7 @@ namespace Discord /// /// Represents a generic message sent by a user. /// - public interface IUserMessage : IMessage + public interface IUserMessage : IReactionMessage { /// /// Modifies this message. @@ -57,90 +57,6 @@ namespace Discord /// Task UnpinAsync(RequestOptions options = null); - /// - /// Gets all reactions included in this message. - /// - IReadOnlyDictionary Reactions { get; } - - /// - /// Adds a reaction to this message. - /// - /// - /// The following example adds the reaction, 💕, to the message. - /// - /// await msg.AddReactionAsync(new Emoji("\U0001f495")); - /// - /// - /// The emoji used to react to this message. - /// The options to be used when sending the request. - /// - /// A task that represents the asynchronous operation for adding a reaction to this message. - /// - /// - Task AddReactionAsync(IEmote emote, RequestOptions options = null); - /// - /// Removes a reaction from message. - /// - /// - /// The following example removes the reaction, 💕, added by the message author from the message. - /// - /// await msg.RemoveReactionAsync(new Emoji("\U0001f495"), msg.Author); - /// - /// - /// The emoji used to react to this message. - /// The user that added the emoji. - /// The options to be used when sending the request. - /// - /// A task that represents the asynchronous operation for removing a reaction to this message. - /// - /// - Task RemoveReactionAsync(IEmote emote, IUser user, RequestOptions options = null); - /// - /// Removes a reaction from message. - /// - /// - /// The following example removes the reaction, 💕, added by the user with ID 84291986575613952 from the message. - /// - /// await msg.RemoveReactionAsync(new Emoji("\U0001f495"), 84291986575613952); - /// - /// - /// The emoji used to react to this message. - /// The ID of the user that added the emoji. - /// The options to be used when sending the request. - /// - /// A task that represents the asynchronous operation for removing a reaction to this message. - /// - /// - Task RemoveReactionAsync(IEmote emote, ulong userId, RequestOptions options = null); - /// - /// Removes all reactions from this message. - /// - /// The options to be used when sending the request. - /// - /// A task that represents the asynchronous removal operation. - /// - Task RemoveAllReactionsAsync(RequestOptions options = null); - - /// - /// Gets all users that reacted to a message with a given emote. - /// - /// - /// The following example gets the users that have reacted with the emoji 💕 to the message. - /// - /// var emoji = new Emoji("\U0001f495"); - /// var reactedUsers = await message.GetReactionUsersAsync(emoji, 100).FlattenAsync(); - /// - /// - /// The emoji that represents the reaction that you wish to get. - /// The number of users to request. - /// The options to be used when sending the request. - /// - /// A paged collection containing a read-only collection of users that has reacted to this message. - /// Flattening the paginated response into a collection of users with - /// is required if you wish to access the users. - /// - IAsyncEnumerable> GetReactionUsersAsync(IEmote emoji, int limit, RequestOptions options = null); - /// /// Transforms this message's text into a human-readable form by resolving its tags. ///