コード例 #1
0
        private async Task <DialogTurnResult> AddInsultResponse(WaterfallStepContext stepContext, CancellationToken cancellationToken)
        {
            NewInsultQnA newInsultQnA = (NewInsultQnA)stepContext.Values[BotConstants.STEP_VALUES_NEW_INSULT_KEY];

            string insultReply = (string)stepContext.Result;

            newInsultQnA.InsultResponse = insultReply;

            // Send adaptive card with new QnA
            await CommonDialogMessages.SendConfirmQnACard(stepContext, cancellationToken, newInsultQnA);

            var text = await PhraseGenerator.GetPhrase(BotConstants.CHAT_CATEGORY_MORE_INSULTS_QUESTION, _brain.GetBastardDBContext());

            return(await stepContext.PromptAsync(nameof(ConfirmPrompt), new PromptOptions()
            {
                Prompt = MessageFactory.Text(text),
                RetryPrompt = MessageFactory.Text($"Seriously, what other insults should I reply '{newInsultQnA.InsultResponse}' to?")
            }));
        }
コード例 #2
0
        private async Task <DialogTurnResult> AskIfMore(WaterfallStepContext stepContext, CancellationToken cancellationToken)
        {
            string newInsult = (string)stepContext.Result;

            NewInsultQnA newInsultQnA = (NewInsultQnA)stepContext.Values[BotConstants.STEP_VALUES_NEW_INSULT_KEY];

            newInsultQnA.Insults.Add(newInsult);

            // Send adaptive card with new QnA
            await CommonDialogMessages.SendConfirmQnACard(stepContext, cancellationToken, newInsultQnA);


            var reply = await PhraseGenerator.GetPhrase(BotConstants.CHAT_CATEGORY_MORE_INSULTS_QUESTION, _context);

            return(await stepContext.PromptAsync(nameof(ConfirmPrompt), new PromptOptions
            {
                Prompt = MessageFactory.Text(reply),
                RetryPrompt = MessageFactory.Text("Soooo...more?")
            }, cancellationToken));
        }