Skip to content

Commit

Permalink
Add reaction events to websocket API
Browse files Browse the repository at this point in the history
  • Loading branch information
nlopes committed Jul 26, 2015
1 parent b19af7f commit 3e8aa56
Show file tree
Hide file tree
Showing 3 changed files with 20 additions and 5 deletions.
11 changes: 6 additions & 5 deletions item.go
Original file line number Diff line number Diff line change
Expand Up @@ -11,11 +11,12 @@ const (

// Item is any type of slack message - message, file, or file comment.
type Item struct {
Type string `json:"type"`
Channel string `json:"channel,omitempty"`
Message *Message `json:"message,omitempty"`
File *File `json:"file,omitempty"`
Comment *Comment `json:"comment,omitempty"`
Type string `json:"type"`
Channel string `json:"channel,omitempty"`
Message *Message `json:"message,omitempty"`
File *File `json:"file,omitempty"`
Comment *Comment `json:"comment,omitempty"`
Timestamp string `json:"ts,omitempty"`
}

// NewMessageItem turns a message on a channel into a typed message struct.
Expand Down
3 changes: 3 additions & 0 deletions websocket.go
Original file line number Diff line number Diff line change
Expand Up @@ -262,6 +262,9 @@ func callEvent(eventType string, ch chan SlackEvent, event json.RawMessage) {
"file_comment_edited": &FileCommentEditedEvent{},
"file_comment_deleted": &FileCommentDeletedEvent{},

"reaction_added": &ReactionAddedEvent{},
"reaction_removed": &ReactionAddedEvent{},

"star_added": &StarAddedEvent{},
"star_removed": &StarRemovedEvent{},

Expand Down
11 changes: 11 additions & 0 deletions websocket_reactions.go
Original file line number Diff line number Diff line change
@@ -0,0 +1,11 @@
package slack

type reactionEvent struct {
Type string `json:"type"`
UserId string `json:"user"`
Item ReactedItem `json:"item"`
Reaction string `json:"reaction"`
EventTimestamp JSONTimeString `json:"event_ts"`
}
type ReactionAddedEvent reactionEvent
type ReactionRemovedEvent reactionEvent

0 comments on commit 3e8aa56

Please sign in to comment.