Class OnReactionAttribute
- Namespace
- Signal.Application.Reactions
- Assembly
- Signal.Application.dll
Runs the method when someone reacts with one of the emojis, by default only to messages the bot's account sent
(polls, approvals). Emojis match regardless of skin tone and variation selector, so 👍 also matches
👍🏽 and ❤ matches ❤️.
[AttributeUsage(AttributeTargets.Method, AllowMultiple = false, Inherited = false)]
public sealed class OnReactionAttribute : Attribute
- Inheritance
-
OnReactionAttribute
- Inherited Members
Examples
public sealed class ApprovalModule : ReactionModule
{
[OnReaction("👍")] public Task ApproveAsync() => ReplyAsync($"Approved by {Context.Sender}.");
}
Constructors
OnReactionAttribute(params string[])
Runs the method when someone reacts with one of the emojis, by default only to messages the bot's account sent
(polls, approvals). Emojis match regardless of skin tone and variation selector, so 👍 also matches
👍🏽 and ❤ matches ❤️.
public OnReactionAttribute(params string[] emojis)
Parameters
emojisstring[]The emojis that trigger the method.
Examples
public sealed class ApprovalModule : ReactionModule
{
[OnReaction("👍")] public Task ApproveAsync() => ReplyAsync($"Approved by {Context.Sender}.");
}
Properties
AnyMessage
Run for reactions to anyone's messages, not only the bot account's own. Default false.
public bool AnyMessage { get; set; }
Property Value
Emojis
The emojis that trigger the method.
public IReadOnlyList<string> Emojis { get; }
Property Value
IncludeRemovals
public bool IncludeRemovals { get; set; }