试图让Alexa的听我的起步请求后,我的回应

问题描述 投票:0回答:1

我很新的发展Alexa的技能,我试图写,将有Alexa的问我,我想知道什么的一天,当我说我的意图它给了我一个响应一个简单的lambda函数。

技能工作正常,问题是以后我说,“开放调用的名字”,它给了我,我的起步请求的响应,但是,当我说我的意图不听我的反应。

例如,如果我说的Alexa上,打开我的技能,它会给我的发射功能,说:“你好,欢迎来到我的课的技能。你想什么天知道的吗?”但是当我说我的话语,开始我的意图功能Alexa的犯规做任何事情。

如果我说“打开我的技能,并说:‘什么都在周一我的班’,将工作,但只有当我说‘打开我的技能’之首。

有没有听功能,我必须写的Alexa承认她的问题,听我的意图是什么?

/* eslint-disable  func-names */
/* eslint quote-props: ["error", "consistent"]*/

'use strict';

const Alexa = require('alexa-sdk');

const handlers = {
    'LaunchRequest': function () {
        this.emit('Launch');
    },

    'MondayIntent': function () {
        this.emit('Monday');
    },

    'TuesdayIntent': function () {
        this.emit('Tuesday');
    },

    'Launch': function() {
        this.response.speak("Hi, Welcome to the my classes skill. What day would you like to know about?"); 
        this.emit(':responseReady');
    },

    'Monday': function() {
        this.response.speak("On Monday you have User Experience at 4:00pm."); 
        this.emit(':responseReady');
    },

     'Tuesday': function() {
        this.response.speak("On Tuesday you have Integrative business Apps at 12:30pm."); 
        this.emit(':responseReady');
    },
    'Unhandled': function() {
        this.response.speak("Sorry, Please say a day of the week?"); 
        this.emit(':responseReady');
    }
};

exports.handler = function (event, context) {
    const alexa = Alexa.handler(event, context);
    alexa.registerHandlers(handlers);
    alexa.execute();
};
aws-lambda alexa alexa-skills-kit alexa-skill alexa-slot
1个回答
0
投票

你的问题是,你正在返回响应准备。你的起步请求应

'LaunchRequest': function () {
      this.emit(':ask', "Hi, Welcome to the my classes skill. What day would you like to know about?");
    },

也许还考虑到你正在使用你的项目,你查看的文件了Alexa-SDK库:https://www.npmjs.com/package/alexa-sdk#basic-project-structure它提供结构为这个应用程序的真正有用的了解。

© www.soinside.com 2019 - 2024. All rights reserved.