jammerware / margiebot

MargieBot is a .NET library designed to make building bots for Slack fast, easy, and fun.
MIT License
122 stars 42 forks source link

Added support for React messages #7

Closed AndrewArace closed 8 years ago

AndrewArace commented 8 years ago

Added support for the slack reactions.add api call.

AndrewArace commented 8 years ago

Sure. In slack, you can add a reaction to any message, via the "add reaction" context menu for a given message, or using the keyboard with a ctrl+shift+\ This adds the functionality to the Bot class, so a responder can add a reaction to a trigger message, and then it would probably return a null response. An example: a responder could be created that performed some action, but instead of sending a response message "okay did it", the responder could just add a :thumbsup: reaction emoticon to the trigger message.

madslyng commented 8 years ago

Okay, that seems good. One comment though. Doesn't it appear to you that a lot of the code is duplicated ? Say() and React() look almost the same.. just wondering if we can improve on that ?

AndrewArace commented 8 years ago

Yes, we probably could - but it had different requirements up to the actual http post. I'll take a look at it tomorrow, I won't be around a computer tonight.

On Fri, Nov 6, 2015, 6:48 PM Steffen Sun Lyng notifications@github.com wrote:

Okay, that seems good. One comment though. Doesn't it appear to you that a lot of the code is duplicated ? Say() and React() look almost the same.. just wondering if we can improve on that ?

— Reply to this email directly or view it on GitHub https://github.com/jammerware/margiebot/pull/7#issuecomment-154579563.

AndrewArace commented 8 years ago

I took a look at the Say() and React() - while similar, there's not much we could do in terms of simplifying them/reducing them. What looks like duplication isn't, since:

So, aside from the GetChatHubId, which I already broke out into a reusable static method, I think we're as simplified as we can be. Do you have any other suggestions?

jammerware commented 8 years ago

@AndrewArace Thanks for your work on this. As you saw, there's another developer trying to do something similar over here, so let's work on that angle together. Sorry for being a little slapdash about keeping up with these pull requests. I'm pretty new to collaboration on github. Thanks again for working on this!

AndrewArace commented 8 years ago

Understood, that's a better approach, anyway. :thumbsup: :)

On Mon, Nov 16, 2015 at 12:59 PM, Jammerware notifications@github.com wrote:

Closed #7 https://github.com/jammerware/margiebot/pull/7.

— Reply to this email directly or view it on GitHub https://github.com/jammerware/margiebot/pull/7#event-465738834.