@@ -108,6 +108,37 @@ export class ActivityHandler {
108
108
return this . on ( 'MembersRemoved' , handler ) ;
109
109
}
110
110
111
+ /**
112
+ * Receives only MessageReaction activities, regardless of whether message reactions were added or removed
113
+ * @remarks
114
+ * MessageReaction activities are sent to the bot when a message reacion, such as 'like' or 'sad' are
115
+ * associated with an activity previously sent from the bot.
116
+ * @param handler BotHandler A handler function in the form async(context, next) => { ... }
117
+ */
118
+ public onMessageReaction ( handler : BotHandler ) : this {
119
+ return this . on ( 'MessageReaction' , handler ) ;
120
+ }
121
+
122
+ /**
123
+ * Receives only MessageReaction activities representing message reactions being added.
124
+ * @remarks
125
+ * context.activity.reactionsAdded will include at least one entry.
126
+ * @param handler BotHandler A handler function in the form async(context, next) => { ... }
127
+ */
128
+ public onReactionsAdded ( handler : BotHandler ) : this {
129
+ return this . on ( 'ReactionsAdded' , handler ) ;
130
+ }
131
+
132
+ /**
133
+ * Receives only MessageReaction activities representing message reactions being removed.
134
+ * @remarks
135
+ * context.activity.reactionsRemoved will include at least one entry.
136
+ * @param handler BotHandler A handler function in the form async(context, next) => { ... }
137
+ */
138
+ public onReactionsRemoved ( handler : BotHandler ) : this {
139
+ return this . on ( 'ReactionsRemoved' , handler ) ;
140
+ }
141
+
111
142
/**
112
143
* Receives all Event activities.
113
144
* @remarks
@@ -216,6 +247,17 @@ export class ActivityHandler {
216
247
}
217
248
} ) ;
218
249
break ;
250
+ case ActivityTypes . MessageReaction :
251
+ await this . handle ( context , 'MessageReaction' , async ( ) => {
252
+ if ( context . activity . reactionsAdded && context . activity . reactionsAdded . length > 0 ) {
253
+ await this . handle ( context , 'ReactionsAdded' , runDialogs ) ;
254
+ } else if ( context . activity . reactionsRemoved && context . activity . reactionsRemoved . length > 0 ) {
255
+ await this . handle ( context , 'ReactionsRemoved' , runDialogs ) ;
256
+ } else {
257
+ await runDialogs ( ) ;
258
+ }
259
+ } ) ;
260
+ break ;
219
261
case ActivityTypes . Event :
220
262
await this . handle ( context , 'Event' , async ( ) => {
221
263
if ( context . activity . name === 'tokens/response' ) {
0 commit comments