2015-09-03 74 views
2

如何让Hubot通过HipChat适配器发送一条直接消息?我尝试了许多不同的选择,但没有成功。Make 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 
    }); 
}; 

回答

4

我花了一段时间来找到它,但事实证明这个工程:

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