@@ -74,8 +74,8 @@ class SlackAccount extends Account {
7474 this . rtm . on ( 'reconnecting' , this . handleConnecting . bind ( this ) )
7575
7676 this . rtm . on ( 'message' , this . dispatchMessage . bind ( this ) )
77- this . rtm . on ( 'reaction_added' , this . reactionAdded . bind ( this ) )
78- this . rtm . on ( 'reaction_removed' , this . reactionRemoved . bind ( this ) )
77+ this . rtm . on ( 'reaction_added' , this . setReaction . bind ( this , true ) )
78+ this . rtm . on ( 'reaction_removed' , this . setReaction . bind ( this , false ) )
7979 this . rtm . on ( 'star_added' , this . setStar . bind ( this , true ) )
8080 this . rtm . on ( 'star_removed' , this . setStar . bind ( this , false ) )
8181
@@ -276,20 +276,15 @@ class SlackAccount extends Account {
276276 }
277277 }
278278
279- reactionAdded ( event ) {
279+ setReaction ( add , event ) {
280280 const channel = this . findChannelById ( event . item . channel )
281281 if ( ! channel )
282282 return
283- const reaction = new SlackReaction ( this , event . reaction , 1 )
284- channel . reactionAdded ( event . item . ts , event . item . ts , reaction )
285- }
286-
287- reactionRemoved ( event ) {
288- const channel = this . findChannelById ( event . item . channel )
289- if ( ! channel )
290- return
291- const reaction = new SlackReaction ( this , event . reaction , - 1 )
292- channel . reactionRemoved ( event . item . ts , event . item . ts , reaction )
283+ const reaction = new SlackReaction ( this , event . reaction , 1 , [ event . user ] )
284+ if ( add )
285+ channel . reactionAdded ( event . item . ts , event . item . ts , reaction )
286+ else
287+ channel . reactionRemoved ( event . item . ts , event . item . ts , reaction )
293288 }
294289
295290 setStar ( hasStar , event ) {
0 commit comments