在 Google NodeJS library v2 上的 Actions 中获取选定的选项键
Get the selected option key in Actions on Google NodeJS library v2
我对 Google 助手的操作使用 Carousel
向用户显示选项列表。轮播中显示的每个项目都有一个选项键。
在 Google NodeJS SDK 的 Actions v1 中,我使用 app.getSelectedOption()
在处理选项选择的意图中访问所选选项的键。
如何在 v2 中访问此密钥?
在 source code of the new SDK 中找到了答案。
处理函数的第三个参数将是选项键:
app.intent('Get Option', (conv, input, option) => {
console.log(option) // This will log the key
}
我对 Google 助手的操作使用 Carousel
向用户显示选项列表。轮播中显示的每个项目都有一个选项键。
在 Google NodeJS SDK 的 Actions v1 中,我使用 app.getSelectedOption()
在处理选项选择的意图中访问所选选项的键。
如何在 v2 中访问此密钥?
在 source code of the new SDK 中找到了答案。
处理函数的第三个参数将是选项键:
app.intent('Get Option', (conv, input, option) => {
console.log(option) // This will log the key
}