예제 #1
0
        private async Task <DialogTurnResult> RespondToName(WaterfallStepContext stepContext, CancellationToken cancellationToken)
        {
            // Respond with name ..
            await TheBot.SendMessage($"Hello, your name is {stepContext.Context.Activity.Text}", stepContext.Context);

            return(await ProceedWithDialog(stepContext));
        }
예제 #2
0
        private async Task <DialogTurnResult> Ask4Name(WaterfallStepContext stepContext, CancellationToken cancellationToken)
        {
            await TheBot.SendMessage("What is your name?", stepContext.Context);

            // Wait for user input ..
            return(await WaitForUserInput(stepContext));
        }
        /// <summary>
        /// Generate a simple answer from the json template of this dialog.
        /// </summary>
        /// <param name="stepContext">the waterfall step context</param>
        /// <param name="cancellationToken">the cancellation token</param>
        /// <returns></returns>
        protected async Task <DialogTurnResult> SimpleAnswer(WaterfallStepContext stepContext, CancellationToken cancellationToken)
        {
            string        json    = MiscExtensions.LoadEmbeddedResource(_smallTalkPath + "." + $"{_top}.json");
            List <string> answers = json == null ? new List <string>() : JsonConvert.DeserializeObject <List <string> >(json);
            await TheBot.SendMessage(GetSimpleAnswer(answers), stepContext.Context);

            return(await ProceedWithDialog(stepContext));
        }
예제 #4
0
        private async Task <DialogTurnResult> PingStep(WaterfallStepContext stepContext, CancellationToken cancellationToken)
        {
            // Send Pong
            await TheBot.SendMessage($"[PONG]: {stepContext.Context.Activity.Text}", stepContext.Context);

            // Continue
            return(await ProceedWithDialog(stepContext));
        }
        private async Task <DialogTurnResult> ClassifySmallTalk(WaterfallStepContext stepContext, CancellationToken cancellationToken)
        {
            var top = TheBot.Result.GetTopScoringIntent().Item1.Substring("st_".Length);

            if (MiscExtensions.LoadEmbeddedResource(SmallTalkPath + "." + $"{top}.json") == null)
            {
                await TheBot.SendMessage($"Ich habe noch nicht gelernt auf {top} zu antworten.", stepContext.Context);
            }
            else
            {
                List <string> answers = FindSpecificAnswers(top);
                await TheBot.SendMessage(GetAnswer(answers), stepContext.Context);
            }
            return(await ProceedWithDialog(stepContext));
        }
예제 #6
0
        private async Task <DialogTurnResult> SorryStep(WaterfallStepContext stepContext, CancellationToken cancellationToken)
        {
            await TheBot.SendMessage("Sorry, I did not understand you ..", stepContext.Context);

            return(await ProceedWithDialog(stepContext));
        }