Skip to content

Commit

Permalink
Merge pull request #511 from aoberoi/docs-reactionmessage-properties
Browse files Browse the repository at this point in the history
add properties of ReactionMessage to docs
  • Loading branch information
aoberoi committed Jul 17, 2018
2 parents b45cb88 + dc00cc9 commit 2088f42
Show file tree
Hide file tree
Showing 2 changed files with 14 additions and 1 deletion.
12 changes: 12 additions & 0 deletions docs/_pages/basic_usage.md
Original file line number Diff line number Diff line change
Expand Up @@ -207,6 +207,18 @@ module.exports = (robot) ->
timestamp: res.message.item.ts
```

When using `robot.react` as shown above, the `res.message` value is of type `ReactionMessage`. In addition to the normal
message properties, this type has a few really helpful properties you might want to use in your script:

* `type`: This is either `"added"` or `"removed"`, depending on whether, you guessed it, the reaction was added or
removed.
* `reaction`: The name of the emoji reaction. For example, when adding a 👍 reaction, this value is
`"thumbsup"`.
* `item`: This is either the message, the file, or the comment where this reaction took place.
* `item_user`: The user who created the item. This value can be `undefined` if the item was created by a custom
integration (not a Slack App).
* `event_ts`: The timestamp of when this reaction message took place.

--------

## Presence changes
Expand Down
3 changes: 2 additions & 1 deletion src/message.coffee
Original file line number Diff line number Diff line change
Expand Up @@ -12,8 +12,9 @@ class ReactionMessage extends Message
# @param {string} type - A String indicating 'reaction_added' or 'reaction_removed'
# @param {User} user - A User instance that reacted to the item.
# @param {string} reaction - A String identifying the emoji reaction.
# @param {User} item_user - A String indicating the user that posted the item.
# @param {Object} item - An Object identifying the target message, file, or comment item.
# @param {User} [item_user] - A String indicating the user that posted the item. If the item was created by a
# custom integration (not part of a Slack app with a bot user), then this value will be undefined.
# @param {string} event_ts - A String of the reaction event timestamp.
###
constructor: (@type, @user, @reaction, @item_user, @item, @event_ts) ->
Expand Down

0 comments on commit 2088f42

Please sign in to comment.