Share via


ActivityHandler.OnMessageReactionActivityAsync Method

Definition

Invoked when an event activity is received from the connector when the base behavior of OnTurnAsync(ITurnContext, CancellationToken) is used. Message reactions correspond to the user adding a 'like' or 'sad' etc. (often an emoji) to a previously sent activity. Message reactions are only supported by a few channels. The activity that the message reaction corresponds to is indicated in the replyToId property. The value of this property is the activity id of a previously sent activity given back to the bot as the response from a send call.

protected virtual System.Threading.Tasks.Task OnMessageReactionActivityAsync (Microsoft.Bot.Builder.ITurnContext<Microsoft.Bot.Schema.IMessageReactionActivity> turnContext, System.Threading.CancellationToken cancellationToken);
abstract member OnMessageReactionActivityAsync : Microsoft.Bot.Builder.ITurnContext<Microsoft.Bot.Schema.IMessageReactionActivity> * System.Threading.CancellationToken -> System.Threading.Tasks.Task
override this.OnMessageReactionActivityAsync : Microsoft.Bot.Builder.ITurnContext<Microsoft.Bot.Schema.IMessageReactionActivity> * System.Threading.CancellationToken -> System.Threading.Tasks.Task
Protected Overridable Function OnMessageReactionActivityAsync (turnContext As ITurnContext(Of IMessageReactionActivity), cancellationToken As CancellationToken) As Task

Parameters

turnContext
ITurnContext<IMessageReactionActivity>

A strongly-typed context object for this turn.

cancellationToken
CancellationToken

A cancellation token that can be used by other objects or threads to receive notice of cancellation.

Returns

A task that represents the work queued to execute.

Remarks

When the OnTurnAsync(ITurnContext, CancellationToken) method receives a message reaction activity, it calls this method. If the message reaction indicates that reactions were added to a message, it calls OnReactionsAddedAsync(IList<MessageReaction>, ITurnContext<IMessageReactionActivity>, CancellationToken). If the message reaction indicates that reactions were removed from a message, it calls OnReactionsRemovedAsync(IList<MessageReaction>, ITurnContext<IMessageReactionActivity>, CancellationToken).

In a derived class, override this method to add logic that applies to all message reaction activities. Add logic to apply before the reactions added or removed logic before the call to the base class OnMessageReactionActivityAsync(ITurnContext<IMessageReactionActivity>, CancellationToken) method. Add logic to apply after the reactions added or removed logic after the call to the base class OnMessageReactionActivityAsync(ITurnContext<IMessageReactionActivity>, CancellationToken) method.

Applies to

See also