Accessing adapter methods from a handler

22 views
Skip to first unread message

danc...@gmail.com

unread,
May 22, 2015, 12:21:28 PM5/22/15
to lit...@googlegroups.com
I'm still pretty new/inexperience with actual development, so sorry if this is something completely obvious that I just don't know how to do:

I am needing to access/add some more slack api calls, but am completely lost on how to even call them from inside a handler. A specific case is adding in the api call to create a room. So in the lita-slack adapter, on the api.rb file, line 22 has the set_topic method. Which calls the api uri "channels.setTopic" with the channel id and topic. This is pretty self explanatory to me, so adding other API methods should be fairly easy for me.....except I don't have a clue how I can even call that method from inside a handler that I am using to test. I'm guessing I need to get a hold of the response_data object that is created when it runs the rtm.start bit, but I don't have a clue on how to do this. Any help? Or is this something I should go to stackoverflow for?

Jimmy Cuadra

unread,
May 23, 2015, 6:59:40 AM5/23/15
to danc...@gmail.com, lit...@googlegroups.com
Hi there!

Your question is a good one and this is the right place to ask it. (You can also find help in the IRC channel, but responses there can vary based on who happens to be there when you ask.)

The answer to your question is that there is currently no way to do what you're trying to do. Adapters in Lita are the glue that makes the Robot class work for different chat services and are meant to be essentially invisible to other parts of the system. Handler code doesn't have direct access to the adapter – all functionality is exposed on the Robot object instead.

Because adapters simply implement the methods required to make Robot work, the interface presented to handlers is uniform across all different chat services. In other words, Robot supports the lowest common denominator of functionality across all chat services. There has been desire, mostly with Slack, for accessing Slack-specific features from Lita, and the discussions for how best to do that are ongoing. The best issue to follow for that right now is https://github.com/kenjij/lita-slack/issues/30, though you may find others on both Lita and lita-slack that might be of interest to you. If you can provide information about what you want to do that you currently can't on any of the GitHub issues, that would be very helpful, as we want to forge any new APIs from real use cases.

Sorry there's no better solution for now! I hope this helps clear things up a bit in the meantime.

Jimmy

On Friday, May 22, 2015 at 9:21 AM, danc...@gmail.com wrote:

I'm still pretty new/inexperience with actual development, so sorry if this is something completely obvious that I just don't know how to do:

I am needing to access/add some more slack api calls, but am completely lost on how to even call them from inside a handler. A specific case is adding in the api call to create a room. So in the lita-slack adapter, on the api.rb file, line 22 has the set_topic method. Which calls the api uri "channels.setTopic" with the channel id and topic. This is pretty self explanatory to me, so adding other API methods should be fairly easy for me.....except I don't have a clue how I can even call that method from inside a handler that I am using to test. I'm guessing I need to get a hold of the response_data object that is created when it runs the rtm.start bit, but I don't have a clue on how to do this. Any help? Or is this something I should go to stackoverflow for?

--
You received this message because you are subscribed to the Google Groups "Lita" group.
To unsubscribe from this group and stop receiving emails from it, send an email to litaio+un...@googlegroups.com.
To post to this group, send email to lit...@googlegroups.com.
For more options, visit https://groups.google.com/d/optout.

Reply all
Reply to author
Forward
0 new messages