【发布时间】:2019-08-23 10:12:20
【问题描述】:
目前,我在 Microsfot BotBuilder V4 NodeJs SDK 中使用 OAuthPrompt。 OAuthPrompt 主要用于 Azure 的机器人身份验证,但在通过机器人登录到 azure 后,我无法移动到瀑布对话框中的下一个功能,直到我向机器人发送另一条消息。如果我在登录后发送消息,则会调用 continueDialog(),因此会调用瀑布对话框中的下一个函数。
如何在不向机器人发送另一条消息的情况下自动移动到瀑布对话框中的下一个功能?
/**
* Waterfall step that prompts the user to login if they have not already or their token has expired.
* @param {WaterfallStepContext} step
*/
async oauthPrompt(step: any) {
await step.prompt(OAUTH_PROMPT);
}
/**
* Waterfall step that informs the user that they are logged in and asks
* the user if they would like to see their token via a prompt
* @param {WaterfallStepContext} step
*/
async loginResults(step: any) {
let tokenResponse = step.result;
if (tokenResponse != null) {
await step.context.sendActivity('You are now logged in.');
return await step.prompt(CONFIRM_PROMPT, 'Do you want to view your token?', ['yes', 'no']);
}
// Something went wrong, inform the user they were not logged in
await step.context.sendActivity('Login was not sucessful please try again');
return await step.endDialog();
}
调用oauthPrompt()后,登录卡显示在bot.但是在那之后 loginResults() 函数不会自动调用,直到我发送另一条消息。两个函数都在同一个瀑布对话框中?
谁能告诉我如何在不向机器人发送另一条消息的情况下调用 loginResults 吗?
【问题讨论】:
-
你在哪个渠道测试这个?
-
我只是微软的bot框架模拟器。请帮帮我。
-
感谢@StevenKanberg。你的说法让我明白了。这个问题会在微软团队中继续存在吗?
-
不应该,但如果确实如此或出现了一些新问题,请在 Stack Overflow 上发布一个新问题,我们会提供帮助。
标签: node.js azure botframework