javascript - 让 Hubot 在 HipChat 中发送直接消息

标签 javascript hubot hipchat

如何告诉 Hubot 使用 HipChat 适配器发送直接消息?我尝试了很多不同的选择,但都没有成功。

module.exports = function (robot) {
  robot.respond(/hi/i, function (msg) {
    msg.send(msg.message.user.room, 'hi'); // outputs to current room
    msg.send(msg.message.user.id, 'hi'); // outputs to current room
    msg.send(msg.message.user, 'hi'); // outputs to current room
    msg.reply('hi'); // @mentions the user in the current room
    msg.reply_to('hi') // no reply_to method though I thought I saw this somewhere
  });
};

最佳答案

我花了一段时间才找到它,但事实证明这是可行的:

module.exports = function (robot) {
  robot.respond(/hi/i, function (msg) {
    robot.send({
      user: msg.message.user.jid
    }, 'hi');
  });
};

关于javascript - 让 Hubot 在 HipChat 中发送直接消息,我们在Stack Overflow上找到一个类似的问题: https://stackoverflow.com/questions/32384359/

相关文章:

coffeescript - Hubot 单元测试未收到响应

jenkins - HipChat 插件不显示 jenkins 中添加的凭据

JavaScript 内存使用管理

JavaScript 相当于 Java 的 URLEncoder.encode ("String", "UTF-8")

hubot - 如何让hubot听到其他关于Slack的集成评论?

ansible - 无论有多少目标,如何只运行一次 ansible 任务

deployment - 如何在 CentOS 6 上安装 Hipchat 服务器?

javascript - 选择类别然后显示类别.尺寸

仅当我在 Firebug 或 Chrome 开发者工具中添加断点时,JavaScript 才会执行

node.js - Hubot-hipchat 可以进行 1-1 聊天,但不能在房间内聊天