json
ファイルのアダプティブカードで選択内容を取得しようとしています。 したがって、アレルギーの選択肢'peanut'
が選択されている場合、それを変数に割り当てる必要があります。しかし、コードはエラーを投げつけ続けます。jsonファイルのセクションに到達できません
適応カードコード:ここで
{
"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)
そして、ここではエラーです:
私はERROR: Cannot read property 'actions' of undefined
[こちらのレポ](https://github.com/matthidinger/ContosoScubaBot)はC#ですが、JSONアダプティブカードを使用しているため役立つかもしれません。ほぼ同じことをするカードを持っています。 [ここで試す](https://contososcubabot.azurewebsites.net) – JasonSowers