MessageFactory.Carousel 方法
定义
重要
一些信息与预发行产品相关,相应产品在发行之前可能会进行重大修改。 对于此处提供的信息,Microsoft 不作任何明示或暗示的担保。
以轮播形式返回包含附件集合的邮件活动。
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
(可选)机器人在启用语音的通道上朗读的文本。
- inputHint
- String
可选,指示机器人在消息传递到客户端后是接受、期待还是忽略用户输入。 之一:“acceptingInput”、“ignoringInput”或“expectingInput”。 默认值为“acceptingInput”。
返回
包含附件的邮件活动。
例外
attachments 为 null。
示例
此代码创建并发送 HeroCard 的轮播。
// 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);