如何将SuggestedActions作为列表而不是轮播

时间:2019-04-03 09:24:26

标签: c# botframework

我想将SuggestedActions列为清单而不是轮播。我可以更改该类型吗?

var reply = turnContext.Activity.CreateReply();

reply.SuggestedActions = new SuggestedActions()
{
    Actions = new List<CardAction>()
    {
        new CardAction() { Title = "Residential Internet Connectivity Issue", Type = ActionTypes.ImBack, Value = "Residential Internet Connectivity Issue" },
        new CardAction() { Title = "Email Issue", Type = ActionTypes.ImBack, Value = "Email Issue" },
        new CardAction() { Title = "Security/Malware issue (Norton)", Type = ActionTypes.ImBack, Value = "Security/Malware issue (Norton)" },
        new CardAction() { Title = "Static IP", Type = ActionTypes.ImBack, Value = "Static IP" },
        new CardAction() { Title = "Product and Service Inquiry", Type = ActionTypes.ImBack, Value = "Product and Service Inquiry" },
        new CardAction() { Title = "Billing Issues", Type = ActionTypes.ImBack, Value = "Billing Issues" },
        new CardAction() { Title = "Payment Arrangements", Type = ActionTypes.ImBack, Value = "Payment Arrangements" },
    },
};

我也尝试过HeroCard

card.Buttons = new List<CardAction>()
{
    new CardAction() { Title = "1. Residential Internet Connectivity Issue", Type = ActionTypes.ImBack, Value = "Residential Internet Connectivity Issue" },
    new CardAction() { Title = "2. Email Issue", Type = ActionTypes.ImBack, Value = "Email Issue" },
    new CardAction() { Title = "3. Security/Malware issue (Norton)", Type = ActionTypes.ImBack, Value = "Security/Malware issue (Norton)" },
    new CardAction() { Title = "4. Static IP", Type = ActionTypes.ImBack, Value = "Static IP" },
    new CardAction() { Title = "5. Product and Service Inquiry", Type = ActionTypes.ImBack, Value = "Product and Service Inquiry" },
    new CardAction() { Title = "6. Billing Issues", Type = ActionTypes.ImBack, Value = "Billing Issues" },
    new CardAction() { Title = "7. Payment Arrangements", Type = ActionTypes.ImBack, Value = "Payment Arrangements" },
};
reply.Attachments = new List<Attachment>() { card.ToAttachment();

但是herocard作为附件的问题在于,它在用户选择一个选项后不会被删除,这与建议的动作不同,在用户选择一个选项后会自动删除。

谢谢!

1 个答案:

答案 0 :(得分:0)

就像卡片一样,建议动作的呈现完全由渠道客户端控制。我所知道的任何渠道均不支持建议操作的格式,但是如果您使用的是Web Chat / Direct Line,则可以自定义客户端以执行所需的操作(尽管这可能很困难并且涉及很多) )。

根据希望该功能受支持的渠道,您可以考虑在相应的GitHub存储库中提出功能请求。