private async Task MessageReceivedAsync(IDialogContext context, IAwaitable <object> result) { var activity = await result as Activity; await activity.StartTypingAndWaitAsync(); var registrationComplete = await EnsureUserRegistrationCompleted(context); if (registrationComplete) { await context.PostAsync($"Olá, {context.GetUserName()}! Alguma novidade?"); context.Done(RootDialog.Ok); } else { var id = context.GetUserId(); if (id.HasValue) { await context.PostAsync($"Olá, {context.GetUserName()}!"); await RegisterUserWalletAsync(context, activity); } else { await WelcomeNewMemberAsync(context, activity); } } }
private async Task MessageReceivedAsync(IDialogContext context, IAwaitable <object> result) { var activity = await result as Activity; if (activity.Type == ActivityTypes.Message) { if (context.UserRegistrationIsCompleted()) { await context.Forward(new FinancialDialog(), FinancialDialogCallback, activity, CancellationToken.None); } else { await context.Forward(new WelcomeDialog(), WelcomeDialogCallback, activity, CancellationToken.None); } } else if (activity.Type == ActivityTypes.ConversationUpdate && activity.MembersAdded?.Any(m => m.Id != activity.Recipient.Id) == true) { var name = context.GetUserName(); var message = string.IsNullOrEmpty(name) ? "Olá, tudo bom?" : $"Olá, {name}!"; await context.PostAsync(message); context.Wait(MessageReceivedAsync); } }