让 Hubot 在 HipChat 中发送直接消息

Make Hubot send a direct message in 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');
  });
};