我正在尝试在json
文件的自适应卡中检索选择。So when the allergic option 'peanut'
is selected, I want to assign it to a variable. 但是代码不断抛出错误。
自适应卡码:
{
"type": "message",
"speak": "...",
"attachments": [
{
"contentType": "application/vnd.microsoft.card.adaptive",
"content": {
"type": "AdaptiveCard",
"version": "1.0",
"body": [
{
"type": "TextBlock",
"text": "Almost there...",
"size": "large",
"weight": "bolder"
}
],
"actions": [
{
"type": "Action.ShowCard",
"title": "Beef",
"card": {
"type": "AdaptiveCard",
"body": [
{
"type": "TextBlock",
"text": "What are you allergic to?",
"size": "medium",
"wrap": true
},
{
"type": "Input.ChoiceSet",
"value": "BeefAllergy",
"id": "BeefAllergy",
"style": "expanded",
"isMultiSelect": false,
"isCompact": false,
"choices": [
{
"title": "Peanut",
"value": "peanut"
},
{
"title": "Seafood",
"value": "seafood"
}
]
}
],
"actions": [
{
"type": "Action.Submit",
"title": "Next",
"data": {
"mealOptions": "beef"
}
}
]
}
}
]
}
}
]
}
这是我尝试将其存储在变量中的方式:
lunchAllergy= session.message.attachments.content.actions.card.body[1].choices[1].value
session.send(lunchallergy)
这是错误:
错误:无法读取未定义的属性“操作”