/// <summary> /// Plays out the 'rebirthing' of BuddyBot while deleteing all of the users private data. /// </summary> /// <param name="context">Mandatory. The context for the execution of a dialog's conversational process.</param> private async Task EraseBuddysMemories(IDialogContext context) { await context.PostAsync("Deleting buddy's memories. 🤖🔨"); await _messageHelpers.ConversationPauseAsync(context, Pause.MediumPause); await context.PostAsync("I hope you're happy."); await _messageHelpers.ConversationPauseAsync(context, Pause.MediumLongPause); _botDataService.DeleteUserData(context); await context.PostAsync("Buddy restored to factory defaults."); await _messageHelpers.ConversationPauseAsync(context, Pause.MediumLongPause); IMessageActivity rebirthGif = context.MakeMessage(); rebirthGif.Attachments.Add(new Attachment() { ContentUrl = "https://media.giphy.com/media/xTiTnlghyAeCrxWePe/giphy.gif", ContentType = "image/gif", Name = "rebirth.gif" }); await context.PostAsync(rebirthGif); await _messageHelpers.ConversationPauseAsync(context, Pause.ExtraLongPause); context.Done("Congratulations!! It's a bot! 😊🤖"); }
/// <summary> /// Execution for the <see cref="ConfirmRobotDialog"/> 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) { await context.PostAsync("Beep Bop... I am indeed a Robot 🤖"); await _messageHelper.ConversationPauseAsync(context, Pause.MediumLongPause); await context.PostAsync("Here's a selfie I took recently."); await _messageHelper.ConversationPauseAsync(context, Pause.MediumLongPause); IMessageActivity message = context.MakeMessage(); message.Attachments.Add(new Attachment() { ContentUrl = "http://assets2.bigthink.com/system/idea_thumbnails/60606/size_1024/robot_child.jpg?1457480666", ContentType = "image/jpeg", Name = "Robots.jpg" }); await context.PostAsync(message); await _messageHelper.ConversationPauseAsync(context, Pause.MediumLongPause); await context.PostAsync("See the computer in the background?"); await _messageHelper.ConversationPauseAsync(context, Pause.MediumPause); context.Done("I use that to reply to you 🤖✌"); }
public async Task HeadsTails(IDialogContext context, LuisResult result) { await context.PostAsync("Flipping a coin.. 🤞"); await _messageHelper.ConversationPauseAsync(context, Pause.ShortPause); await context.PostAsync("The result is..."); await _messageHelper.ConversationPauseAsync(context, Pause.MediumLongPause); await context.PostAsync(await _headTailsService.GetRandomHeadsTails()); context.Wait(MessageReceived); }
/// <summary> /// Generates random number and posts that number to the user, ending the dialog. /// </summary> /// <param name="context"></param> /// <param name="context">Mandatory. The context for the execution of a dialog's conversational process.</param> /// <param name="min">Mandatory. The lower number range.</param> /// <param name="max">Mandatory. The higher number range.</param> /// <returns></returns> private async Task PickRandomNumber(IDialogContext context, int min, int max) { var randomNumber = new Random().Next(_min, _max); await context.PostAsync($"Generating a random number between {_min} & {_max}... 🎲"); await _messageHelpers.ConversationPauseAsync(context, Pause.ShortMediumPause); context.Done($"The result is... {randomNumber}! 🎉🎉"); }
/// <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; } }