【发布时间】:2021-02-01 20:26:06
【问题描述】:
const FactIntentHandler = {
canHandle(handlerInput) {
const request = handlerInput.requestEnvelope.request;
return (request.type === 'IntentRequest' && request.intent.name === 'GetFactIntent');
//&& Alexa.getIntentName(handlerInput.requestEnvelope) === 'GetFactIntent';
},
handle(handlerInput) {
var newFact = pitFile.facts[Math.floor(Math.random() * pitFile.fact.length)];//search for fact to return in random order 000561
var factResult = newFact.text; // store fact 000561
//speakoutput is a var and not a const because we want it to change 000561
var speakOutput = "Here's why we love pits:" + factResult;
return handlerInput.responseBuilder
.speak(speakOutput)
//.reprompt(speakOutput)
.getResponse();
}
};
这是我的代码,我使用的是 hello world 模板。我编辑了内置的 helloworld 意图,但是当我调用 getfactintent 时,我收到一条错误消息。
【问题讨论】:
标签: node.js aws-lambda alexa alexa-skills-kit