/ / AzureボットNodejs関数呼び出し-node.js、azure、ボット、チャットボット、azure-bot-service

Azure bot Nodejs関数呼び出し - node.js、azure、bots、chatbot、azure-bot-service

特定の機能に移動する必要があるボットのダイアログを呼び出そうとしています。ここにシナリオがあります... 以下に示すようなダイアログボットがあります

bot.dialog("/Welcome", [
function(session){
builder.Prompts.text(session, "Welcome to the Bot");
},
function (session, args) {
// Has some code
},
function (session, args){
//has some code
}......

ダイアログを置き換えるときはいつでも。

bot.replaceDialog("/Welcome")

つまり、最初の関数に行くべきではありません。 ボットへようこそ これをスキップして、次の機能に進む必要があります。

Azureボットでこれを達成する方法はありますか?

回答:

回答№1は0

あなたは彼らの記事を見ればこれは非常に簡単です

https://docs.microsoft.com/en-us/azure/bot-service/nodejs/bot-builder-nodejs-dialog-replace

彼らの例は以下のようなものです

// This dialog prompts the user for a phone number.
// It will re-prompt the user if the input does not match a pattern for phone number.
bot.dialog("phonePrompt", [
function (session, args) {
if (args && args.reprompt) {
builder.Prompts.text(session, "Enter the number using a format of either: "(555) 123-4567" or "555-123-4567" or "5551234567"")
} else {
builder.Prompts.text(session, "What"s your phone number?");
}
},
function (session, results) {
var matched = results.response.match(/d+/g);
var number = matched ? matched.join("") : "";
if (number.length == 10 || number.length == 11) {
session.userData.phoneNumber = number; // Save the number.
session.endDialogWithResult({ response: number });
} else {
// Repeat the dialog
session.replaceDialog("phonePrompt", { reprompt: true });
}
}
]);

だからあなたのものは次のようなものになります

bot.dialog("/Welcome", [
function(session, args, next){
if (!args || args.prompt)
builder.Prompts.text(session, "Welcome to the Bot");
else
next();
},
function (session, args) {
// Has some code
},
function (session, args){
//has some code
}......

以下のように呼び出します

bot.replaceDialog("/Welcome", {prompt: false}))