我怎样才能让我的机器人问一个声明,等待该声明的回应
How can i make my bot ask a statement, wait for the response of that statement
有什么方法可以让我问我的机器人一个问题,让它等待对那个特定问题的回应,这样我就可以对那个特定的消息做更多的事情吗?
是的,botkit 自述文件中有示例。复制粘贴:
controller.hears(['question me'], 'message_received',function(bot,message) {
// start a conversation to handle this response.
bot.startConversation(message,function(err,convo) {
convo.ask('How are you?',function(response,convo) {
convo.say('Cool, you said: ' + response.text);
convo.next();
});
})
})
有什么方法可以让我问我的机器人一个问题,让它等待对那个特定问题的回应,这样我就可以对那个特定的消息做更多的事情吗?
是的,botkit 自述文件中有示例。复制粘贴:
controller.hears(['question me'], 'message_received',function(bot,message) {
// start a conversation to handle this response.
bot.startConversation(message,function(err,convo) {
convo.ask('How are you?',function(response,convo) {
convo.say('Cool, you said: ' + response.text);
convo.next();
});
})
})