我想通过“自适应对话框”中的SendActivity返回一个自适应卡。
执行此操作的代码如下所示:
new OnIntent("Help")
{
Actions = new List<Dialog>()
{
new SendActivity("${Help-Root-Dialog()}")
}
},
但是,我想在调用中包含一个参数来创建自适应卡。假设有一个用户名(因此可以个性化地向用户发送消息。有没有办法做到这一点?
找到了几种方法来做到这一点:
new SetProperty()
{
Property = "conversation.gameCreateDate",
Value = DateTime.Now.ToString()
},
new SendActivity("${PlayGameCard()}"),
//In .lg file:
# PlayGameCard
[Activity
Attachments = ${json(AdaptiveCard.Definition())}
]
//...
{
"type": "TextBlock",
"spacing": "None",
"text": "Created ${conversation.gameCreateDate}",
"isSubtle": true,
"wrap": true
}
//...
await turnContext.SendActivityAsync(ActivityFactory.FromObject( _templates.Evaluate("SomethingWentWrong", exception)));
我使用了选项1,但似乎是2。
本文收集自互联网,转载请注明来源。
如有侵权,请联系 [email protected] 删除。
我来说两句