2015-09-03 104 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'); 
    }); 
};