我正在我的一个项目中研究机器人框架技术,我希望在以下链接https://docs.botframework.com/en-us/csharp/builder/sdkreference/attachments.html后面显示收据卡,以便在我的项目中添加收据卡。
这是我的收据卡代码。
#region Receipt Card
ConnectorClient connector = new ConnectorClient(new Uri(activity.ServiceUrl));
Activity replyToConversation = activity.CreateReply("Welcome to **** Hotels.");
replyToConversation.Recipient = activity.From;
replyToConversation.Type = "message";
replyToConversation.Attachments = new List<Attachment>();
//List<CardImage> cardImages = new List<CardImage>();
//cardImages.Add(new CardImage(url: "http://cache.*****.com/propertyimages/h/hydcy/hydcy_main02.jpg",alt: "The **** Hyderabad welcomes guests to the heart of the city centre with an array of amenities and comfortable, sophisticated lodging."));
List<CardAction> cardButtons = new List<CardAction>();
CardAction plButton = new CardAction()
{
Value = "http://www.*****.com/hotels/travel/hydcy-courtyard-hyderabad/",
Type = "openUrl",
Title = "Confirmed"
};
cardButtons.Add(plButton);
ReceiptItem lineItem1 = new ReceiptItem()
{
Title = "***** Hyderabad",
Subtitle = "*****, Hyderabad, IN 500 080",
Text= "The **** Hyderabad welcomes guests to the heart of the city centre with an array of amenities and comfortable, sophisticated lodging."
};
ReceiptItem lineItem2 = new ReceiptItem()
{
Title="Executive Deluxe,Guest Room",
Image = new CardImage(url: "http://cache.****.com/propertyimages/h/hydcy/hydcy_main02.jpg"),
Price = "7000.25",
Quantity = "1",
Tap = null
};
List<ReceiptItem> receiptList = new List<ReceiptItem>();
receiptList.Add(lineItem1);
receiptList.Add(lineItem2);
ReceiptCard plCard = new ReceiptCard()
{
Title = "**** Hyderabad Hotel Reservation Confirmed",
Buttons = cardButtons,
Items = receiptList,
Tax = "27.52",
Total = "7027.77"
};
Attachment plAttachment = plCard.ToAttachment();
replyToConversation.Attachments.Add(plAttachment);
var reply = await connector.Conversations.SendToConversationAsync(replyToConversation);
#endregion
在上面我添加了两个不同标题的收据项目,但最后在我的收据卡上的两个收据项目中只显示了一个标题名称,如下图所示。
请告诉我,如何解决上述问题。
我认为Bot Framework Channel Emulator中可能存在错误。
-Kishore。
答案 0 :(得分:0)
感谢您在模拟器中识别错误。它已经修复,应该很快发布。