語言

MessageFactory.Carousel 方法

定義

回傳包含多個附件的訊息活動,作為輪播。

public static Microsoft.Bot.Schema.IMessageActivity Carousel(System.Collections.Generic.IEnumerable<Microsoft.Bot.Schema.Attachment> attachments, string text = default, string ssml = default, string inputHint = default);
static member Carousel : seq<Microsoft.Bot.Schema.Attachment> * string * string * string -> Microsoft.Bot.Schema.IMessageActivity
Public Shared Function Carousel (attachments As IEnumerable(Of Attachment), Optional text As String = Nothing, Optional ssml As String = Nothing, Optional inputHint As String = Nothing) As IMessageActivity

參數

attachments
IEnumerable<Attachment>

訊息中要附上的附件。

text
String

選擇性的訊息要傳送的文字。

ssml
String

選擇性的文字,由 Bot 在啟用語音功能的通道上說出。

inputHint
String

選擇性表示 Bot 在訊息傳遞至客戶端之後是否接受、預期或忽略使用者輸入。 其中一個:「acceptingInput」、“ignoringInput” 或 “expectingInput”。 預設值為 「acceptingInput」。。

傳回

包含附件的郵件活動。

例外狀況

attachments 是 null。

範例

這段程式碼會產生並傳送一組英雄卡。

// Create the activity and attach a set of Hero cards.
var activity = MessageFactory.Carousel(
new Attachment[]
{
    new HeroCard(
        title: "title1",
        images: new CardImage[] { new CardImage(url: "imageUrl1.png") },
        buttons: new CardAction[]
        {
            new CardAction(title: "button1", type: ActionTypes.ImBack, value: "item1")
        })
    .ToAttachment(),
    new HeroCard(
        title: "title2",
        images: new CardImage[] { new CardImage(url: "imageUrl2.png") },
        buttons: new CardAction[]
        {
            new CardAction(title: "button2", type: ActionTypes.ImBack, value: "item2")
        })
    .ToAttachment(),
    new HeroCard(
        title: "title3",
        images: new CardImage[] { new CardImage(url: "imageUrl3.png") },
        buttons: new CardAction[]
        {
            new CardAction(title: "button3", type: ActionTypes.ImBack, value: "item3")
        })
    .ToAttachment()
});

// Send the activity as a reply to the user.
await context.SendActivity(activity);

適用於

另請參閱