简体   繁体   English

让Hubot在HipChat中发送直接消息

[英]Make Hubot send a direct message in HipChat

How do I tell Hubot to send a direct message using the HipChat adapter? 如何告诉Hubot使用HipChat适配器发送直接消息? I've tried many different options without success. 我尝试了许多不同的选择,但均未成功。

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
  });
};

It took me awhile to find it, but it turns out this works: 我花了一段时间才找到它,但事实证明这可行:

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

声明:本站的技术帖子网页,遵循CC BY-SA 4.0协议,如果您需要转载,请注明本站网址或者原文地址。任何问题请咨询:yoyou2525@163.com.

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