//Verifica si se ha recibido una actividad del usuario protected override async Task OnMessageActivityAsync(ITurnContext <IMessageActivity> turnContext, CancellationToken cancellationToken) { //return base.OnMessageActivityAsync(turnContext, cancellationToken); //Demo #1 //var vMessage = turnContext.Activity.Text; //await turnContext.SendActivityAsync($"El Usuario dijo: { vMessage }", cancellationToken: cancellationToken); //Demo #2 y 3 //await _dialog.RunAsync( // turnContext, // _conversationState.CreateProperty<DialogState>(nameof(DialogState)), // cancellationToken); //Demo #4 var vMessage = turnContext.Activity.Text.ToLower(); if (vMessage.Equals("imagen")) { await turnContext.SendActivityAsync(AttachmentCard.GetImage(), cancellationToken); } else if (vMessage.Equals("imagengif")) { await turnContext.SendActivityAsync(AttachmentCard.GetImageGIF(), cancellationToken); } else if (vMessage.Equals("video")) { await turnContext.SendActivityAsync(AttachmentCard.GetVideo(), cancellationToken); } else if (vMessage.Equals("audio")) { await turnContext.SendActivityAsync(AttachmentCard.GetAudio(), cancellationToken); } else if (vMessage.Equals("documento")) { await turnContext.SendActivityAsync(AttachmentCard.GetDocumento(), cancellationToken); } else if (vMessage.Equals("cuentas")) { await turnContext.SendActivityAsync(AttachmentCard.GetAccount(), cancellationToken); } else if (vMessage.Equals("certificado")) { try { await turnContext.SendActivityAsync(AttachmentCard.GetCertificate1(), cancellationToken); } catch (System.Exception ex) { throw new System.Exception(ex.Message); } } else { await turnContext.SendActivityAsync("Opción no válida", cancellationToken : cancellationToken); } }
protected override async Task OnMessageActivityAsync(ITurnContext <IMessageActivity> turnContext, CancellationToken cancellationToken) { var vMessage = turnContext.Activity.Text.ToLower(); if (vMessage.Equals("imagen")) { await turnContext.SendActivityAsync(AttachmentCard.GetImage(), cancellationToken); } else if (vMessage.Equals("imagengif")) { await turnContext.SendActivityAsync(AttachmentCard.GetImageGIF(), cancellationToken); } else if (vMessage.Equals("video")) { await turnContext.SendActivityAsync(AttachmentCard.GetVideo(), cancellationToken); } else if (vMessage.Equals("audio")) { await turnContext.SendActivityAsync(AttachmentCard.GetAudio(), cancellationToken); } else if (vMessage.Equals("documento")) { await turnContext.SendActivityAsync(AttachmentCard.GetDocumento(), cancellationToken); } else if (vMessage.Equals("cuentas")) { await turnContext.SendActivityAsync(AttachmentCard.GetAccount(), cancellationToken); } else if (vMessage.Equals("certificado")) { try { await turnContext.SendActivityAsync(AttachmentCard.GetCertificate1(), cancellationToken); } catch (System.Exception ex) { throw new System.Exception(ex.Message); } } else { await turnContext.SendActivityAsync("Opción no válida", cancellationToken : cancellationToken); } }