代码之家  ›  专栏  ›  技术社区  ›  marcorei

在Google NodeJS library v2上的操作中获取所选选项键

  •  0
  • marcorei  · 技术社区  · 6 年前

    我对Google助手的操作使用 Carousel 。旋转木马中显示的每个项目都有一个选项键。

    在我使用的Google NodeJS SDK上的v1操作中 app.getSelectedOption() 在处理选项选择的意图中访问所选选项的键。

    如何在v2中访问此密钥?

    1 回复  |  直到 6 年前
        1
  •  0
  •   marcorei    6 年前

    在中找到答案 source code of the new SDK

    handler函数的第三个参数是选项键:

    app.intent('Get Option', (conv, input, option) => {
      console.log(option) // This will log the key
    }