Alexa意向被触发,但回答是“对不起,我在执行您的要求时遇到了麻烦。请重试。”

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

我正在使用城市老虎机。所以,现在我想做的就是让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();
    }
};
node.js alexa alexa-skill alexa-slot
1个回答
0
投票

您可以使用以下代码获取广告位值。

Alexa.getSlotValue(SlotName)

或者如果您想以标准方式进行,则可以执行以下操作。

handlerInput.requestEnvelope.request.intent.slots.SlotName.value
© www.soinside.com 2019 - 2024. All rights reserved.