-
Notifications
You must be signed in to change notification settings - Fork 663
New issue
Have a question about this project? Sign up for a free GitHub account to open an issue and contact its maintainers and the community.
By clicking “Sign up for GitHub”, you agree to our terms of service and privacy statement. We’ll occasionally send you account related emails.
Already on GitHub? Sign in to your account
Implement stars and removed stars #27
Conversation
…ck.com/events/star_removed (for everything, not just messages). It's up to the app to react to what's being starred/unstarred.
@onStarAdded JSON.parse(data) | ||
|
||
@ws.on 'star_added', (data, flags) => | ||
@onStarRemoved JSON.parse(data) |
There was a problem hiding this comment.
Choose a reason for hiding this comment
The reason will be displayed to describe this comment to others. Learn more.
Is this a typo? Calling onStarRemoved when star_added is emitted?
Typo fixed. Now that I test it again, Slack's API isn't sending me 'star_added' or 'star_removed' events in my test app. Hmm. |
…n a 'message' ws event. This passes on the 'message' object, which is the more abstract ws message, not Slacks 'Message' object. This was tested on starring Slack messages, channels, and uploaded files. It's up to the app to look at the item.type property to determine what to do with the starring/unstarring.
I think I have it now. The confusion lay in what what the ws module calls messages and what the Slack app calls messages. The latest commit added the event to the onMessage() handler, which handles ws messages. That handler switches on events Slack sends along. It stores the raw message object in the 'message' variable, so the star_added and star_removed events send that along too (and not, as I had in a previous PR, just sent along the object of class Message). Does that make sense? This commit sends along the more abstract 'message' that ws sends to onMessage, and the app using this library will have to handle the object it receives by looking at the item.type property. |
Thanks for working through this - this updated version looks great (and sorry again for messing up your last pull request!) |
Implement stars and removed stars
This is for everything, not just messages. So files, channels, etc. are covered. It's up to the app to react to what's being starred/unstarred in the item.type property.