[Feature] Super reactions support (#2707)

* super reactions

* add type to `GetReactionUsers` methods

* add `MeBurst`
This commit is contained in:
Mihail Gribkov
2023-11-18 23:57:11 +03:00
committed by GitHub
parent e3cd340dcc
commit 9fd5c6c27e
16 changed files with 347 additions and 169 deletions

View File

@@ -202,6 +202,7 @@ namespace Discord
#region Reactions (90XXX)
ReactionBlocked = 90001,
CannotUseBurstReaction = 90002,
#endregion
#region API Status (130XXX)

View File

@@ -323,9 +323,11 @@ namespace Discord
/// <param name="emoji">The emoji that represents the reaction that you wish to get.</param>
/// <param name="limit">The number of users to request.</param>
/// <param name="options">The options to be used when sending the request.</param>
/// <param name="type">The type of the reaction you wish to get users for.</param>
/// <returns>
/// Paged collection of users.
/// </returns>
IAsyncEnumerable<IReadOnlyCollection<IUser>> GetReactionUsersAsync(IEmote emoji, int limit, RequestOptions options = null);
IAsyncEnumerable<IReadOnlyCollection<IUser>> GetReactionUsersAsync(IEmote emoji, int limit, RequestOptions options = null,
ReactionType type = ReactionType.Normal);
}
}

View File

@@ -1,13 +1,22 @@
namespace Discord
using System.Collections.Generic;
namespace Discord;
/// <summary>
/// Represents a generic reaction object.
/// </summary>
public interface IReaction
{
/// <summary>
/// Represents a generic reaction object.
/// The <see cref="IEmote" /> used in the reaction.
/// </summary>
public interface IReaction
{
/// <summary>
/// The <see cref="IEmote" /> used in the reaction.
/// </summary>
IEmote Emote { get; }
}
IEmote Emote { get; }
/// <summary>
/// Gets colors used for the super reaction.
/// </summary>
/// <remarks>
/// The collection will be empty if the reaction is a normal reaction.
/// </remarks>
public IReadOnlyCollection<Color> BurstColors { get; }
}

View File

@@ -1,24 +1,40 @@
namespace Discord
using System.Collections.Generic;
namespace Discord;
/// <summary>
/// A metadata containing reaction information.
/// </summary>
public struct ReactionMetadata
{
/// <summary>
/// A metadata containing reaction information.
/// Gets the number of reactions.
/// </summary>
public struct ReactionMetadata
{
/// <summary>
/// Gets the number of reactions.
/// </summary>
/// <returns>
/// An <see cref="int"/> representing the number of this reactions that has been added to this message.
/// </returns>
public int ReactionCount { get; internal set; }
/// <returns>
/// An <see cref="int"/> representing the number of this reactions that has been added to this message.
/// </returns>
public int ReactionCount { get; internal set; }
/// <summary>
/// Gets a value that indicates whether the current user has reacted to this.
/// </summary>
/// <returns>
/// <see langword="true" /> if the user has reacted to the message; otherwise <see langword="false" />.
/// </returns>
public bool IsMe { get; internal set; }
/// <summary>
/// Gets a value that indicates whether the current user has reacted to this.
/// </summary>
/// <returns>
/// <see langword="true" /> if the user has reacted to the message; otherwise <see langword="false" />.
/// </returns>
public bool IsMe { get; internal set; }
}
/// <summary>
/// Gets the number of burst reactions added to this message.
/// </summary>
public int BurstCount { get; internal set; }
/// <summary>
/// Gets the number of normal reactions added to this message.
/// </summary>
public int NormalCount { get; internal set; }
/// <summary>
/// Gets colors used for super reaction.
/// </summary>
public IReadOnlyCollection<Color> BurstColors { get; internal set; }
}

View File

@@ -0,0 +1,14 @@
namespace Discord;
public enum ReactionType
{
/// <summary>
/// The reaction is a normal reaction.
/// </summary>
Normal = 0,
/// <summary>
/// The reaction is a super reaction.
/// </summary>
Burst = 1,
}