我正在使用城市老虎机。所以,现在我想做的就是让Alexa说出城市名称。但这不起作用。
const GetCityNameIntent = {
canHandle(handlerInput) {
return Alexa.getRequestType(handlerInput.requestEnvelope) === 'IntentRequest'
&& Alexa.getIntentName(handlerInput.requestEnvelope) === 'GetCityNameIntent';
},
handle(handlerInput) {
const cityName = this.event.request.intent.slots.City.value;
const speakOutput = `${cityName} is this` ;
return handlerInput.responseBuilder
.speak(speakOutput)
//.reprompt(speakOutput)
.getResponse();
}
};
您可以使用以下代码获取广告位值。
Alexa.getSlotValue(SlotName)
或者如果您想以标准方式进行,则可以执行以下操作。
handlerInput.requestEnvelope.request.intent.slots.SlotName.value