简体   繁体   中英

Lita.io Handler Plugin - How to get a list of all joined rooms

I am in the process of writing a Handler Plugin for lita.io. What I want to do is provide a HTTP POST endpoint and when it is called I want to publish some chat message to all rooms that Lita has joined.

I already succeeded with posting to a specific room that is identified as parameter in the HTTP call doing it like this:

def receive(request, response)
room = request.params['room']
    Lita.logger.debug("stash-post-receive: room = #{room}")
    target = Source.new(room: room)
    json_data = parse_json(request.body.read) or return
    message = format_message(json_data)
    robot.send_message(target, message)
end

But this requires the caller to already supply which room to post to. Is there a way to retrieve a list of all rooms that Lita has joined so I can post there?

Currently there is not a generic way to do this. The adapter would have to expose an adapter-specific API for it.

The technical post webpages of this site follow the CC BY-SA 4.0 protocol. If you need to reprint, please indicate the site URL or the original address.Any question please contact:yoyou2525@163.com.

 
粤ICP备18138465号  © 2020-2024 STACKOOM.COM