示例#1
0
 /// <summary>
 /// Sends a message whenever there is unrecognized input into the bot
 /// </summary>
 /// <param name="turnContext">Context object containing information cached for a single turn of conversation with a user.</param>
 /// <param name="replyActivity">The activity for replying to a message</param>
 /// <param name="cancellationToken">Propagates notification that operations should be canceled.</param>
 /// <returns>Tracking task</returns>
 private async Task SendUnrecognizedInputMessageAsync(ITurnContext turnContext, Activity replyActivity, CancellationToken cancellationToken)
 {
     replyActivity.Attachments = new List <Attachment> {
         UnrecognizedInputAdaptiveCard.GetCard()
     };
     await turnContext.SendActivityAsync(replyActivity, cancellationToken);
 }
        /// <summary>
        /// Sends a message whenever there is unrecognized input into the bot
        /// </summary>
        /// <param name="connectorClient">The connector client</param>
        /// <param name="replyActivity">The activity for replying to a message</param>
        /// <returns>Tracking task</returns>
        public async Task SendUnrecognizedInputMessage(ConnectorClient connectorClient, Activity replyActivity)
        {
            var unrecognizedInputAdaptiveCard = UnrecognizedInputAdaptiveCard.GetCard();

            replyActivity.Attachments = new List <Attachment>()
            {
                new Attachment()
                {
                    ContentType = "application/vnd.microsoft.card.adaptive",
                    Content     = JsonConvert.DeserializeObject(unrecognizedInputAdaptiveCard)
                }
            };
            await connectorClient.Conversations.ReplyToActivityAsync(replyActivity);
        }