2017-03-07 7 views
0

私はアクセス機能のための簡単なチャットボットを開発しています。私はパスワードリセット機能のためのプロンプトダイアログを持っている必要があります。 likeユーザーアカウントがforgotpassword/lockedの場合、私は秘密の質問にユーザーに尋ねています。そして、秘密の質問に対する回答が質問に一致している場合は、ユーザーに1回限りのパスワードを再試行するオプションを生成します。 ここは私のコードです.. boolChoice(LuisIntent)は、ユーザーがパスワードを忘れたくないときです。その後、私は答えが、その後のマッチングされ、私はワンタイムpassswordまたは私は再び彼を促すために必要なもの、次に一致しない場合、ユーザーに促すために必要がある場合は、何をする必要があるかResumeAfterSecretAnswer内部今プロンプトダイアログをパスワードリセット機能に使用する必要があります

if (boolChoice.ToLower().Equals("yes")) 
      { 
       PromptDialog.Text(
       context: context, 
       resume: ResumeAfterSecretAnswer, 
       prompt: "Ok. I need you to answer your secret question: "+getSecretQuestionForUser(), 
       retry: "I didn't understand. Please try again."); 
      } 
private string getSecretQuestionForUser() 
     { 
      return "What is your favorite color?"; 
     } 

private async Task ResumeAfterSecretAnswer(IDialogContext context, IAwaitable<string> result) 
     { 
      string answer = await result; 
      //suppose right answer is blue.. then what next i need to do . do I need to prompt here or how do I compare and generate the one time password. 
// need a flow,... 
     } 

を促すメッセージが表示されます。そして

私は流れに少し混乱しています..私はPromoptDialog.Confirmまたは何か他のものを使用する必要がpromptdialogた。..

は、今私は方法を変更した、ここで流れ... ...どうあるべきか

私が持っている

は...今の答えが一致しない場合、私は他の部分には何をすべきか

private async Task ResumeAfterSecretAnswer(IDialogContext context, IAwaitable<string> result) 
     { 
      string answer = await result; 

      if (answer.ToLower() == getSecretAnswerForUser()) 
       await context.PostAsync("Your One time password is: "+ getOneTimePasswordForUser()); 
      else 
       await context.PostAsync("The answers do not match. Please try again."); 

      context.Wait(MessageReceived); 

     } 

の方法を変更します。私は再びユーザーにプロンプ​​トを出す必要があります..私はここでどのようにしたらいいですか...これを実現します。

助けてください。

答えて

0

は、あなただけの他に、再びこれを呼び出す必要があり、私はあなたがこの方法でそれを置くことをお勧め:

PromptDialog.Text(
       context: context, 
       resume: ResumeAfterSecretAnswer, 
       prompt: "Ok. I need you to answer your secret question: "+getSecretQuestionForUser(), 
       retry: "I didn't understand. Please try again."); 

が他からcontext.wait(MessageReceived)に注意してください、それがスローすることがありますダイアログの複数の出口のため例外です

関連する問題