示例#1
0
        /// <summary>
        /// Execution for the <see cref="GetStartedDialog"/> starts here.
        /// </summary>
        /// <param name="context">Mandatory. The context for the execution of a dialog's conversational process.</param>
        public async Task StartAsync(IDialogContext context)
        {
            if (_botDataService.hasCompletedGetStarted(context))
            {
                // user has already done setup, show them what Buddy can do
                await FinishAsync(context);
            }
            else
            {
                // Introductions and user setup
                await context.PostAsync("Hi there... 🤔");

                await _messageHelper.ConversationPauseAsync(context, Pause.MediumPause);

                await context.PostAsync("I don't think, we've met before? Let me introduce myself..");

                await _messageHelper.ConversationPauseAsync(context, Pause.LongerPause);


                await context.PostAsync("I'm BuddyBot! I'm an intelligent personal assistant, here to help wherever I can! 😀");

                await _messageHelper.ConversationPauseAsync(context, Pause.LongPause);


                await context.PostAsync("Let's get you setup. Remember, I'm still learning, so be patient, and follow my prompts carefully!");

                await _messageHelper.ConversationPauseAsync(context, Pause.LongPause);

                context.Call(_dialogBuilder.BuildNameDialog(context.Activity.AsMessageActivity()), Resume_AfterNameDialog);
                await Task.CompletedTask;
            }
        }
示例#2
0
        public async Task Greeting(IDialogContext context, LuisResult result)
        {
            string name = _botDataService.GetPreferredName(context);
            bool   hasCompletedGetStarted = _botDataService.hasCompletedGetStarted(context);

            if (hasCompletedGetStarted)
            {
                // Just say hey
                await context.PostAsync(await _conversationService.GetGreeting(name));
            }
            else
            {
                // Run the setup/tutorial
                context.Call(_dialogBuilder.BuildGetStartedDialog(GetMessageActivity(context)), Resume_AfterGetStartedDialog);
            }
        }