首先,我是node.js
的初学者,并试图理解:
bot.dialog('askForLocation', [
function (session, args) {
if (args && args.reprompt) {
builder.Prompts.text(session, "Enter a proper location");
} else {
builder.Prompts.text(session, "What's your meeting location?");
}
},
如何在此代码之后获取用户输入以供日后使用,让我们说用户说california
它存储在哪里以及如何在另一个函数中使用它?< / p>
答案 0 :(得分:1)
这是将prompts
数据作为response
bot.dialog('askForLocation', [
// Step 1
function (session) {
if (args && args.reprompt) {
builder.Prompts.text(session, "Enter a proper location");
} else {
builder.Prompts.text(session, "What's your meeting location?");
}
},
// Step 2
function (session, results) {
session.endDialog(`Hello from location name = ${results.response}!`);
}
]);
查看更多信息:https://docs.microsoft.com/en-us/bot-framework/nodejs/bot-builder-nodejs-dialog-prompt