代码之家  ›  专栏  ›  技术社区  ›  Alex Cohen

如何用rubylita转发消息响应?

  •  0
  • Alex Cohen  · 技术社区  · 7 年前

    我和一个聊天机器人一起工作 lita ruby gem 使用lita hipchat。在使用hipchat对lita做出响应后,lita将能够将消息返回给通过创建响应的用户 the reply method . 我想改变这种模式,并能够发送一个hipchat给第二用户,基本上能够抄送或转发相同的响应给多个用户。这可能只使用利塔宝石吗?

    我知道通过http或hipchatgem发送消息是另一种向次要用户发送消息的选择,但是我更希望通过lita来实现。

    0 回复  |  直到 7 年前
        1
  •  1
  •   Jimmy Nitzan Tomer    7 年前

    你可以用 Robot#send_messages

    def my_handler_route(response)
      user2 = Lita::User.find_by_id("user2")
      target = Lita::Source(user: user2)
      robot.send_message(target, "This message will go to User2!")
    end
    

    这基本上是什么 Response#reply

    推荐文章