Вы можете вызвать любой обработчик из другого намеренного обработчика.
alexa-nodejs-sdk v1
Для alexa-nodejs-sdk
v1 вы можете использовать
'SomeOtherIntent': function() {
// Do your stuff here
// Now to call AMAZON.YesIntent intent handler
this.emit('AMAZON.YesIntent');
}
alexa-nodejs-sdk v2
Для alexa-nodejs-sdk
v2 вы можете импортировать функцию дескриптора цели (если она находится в другом модуле) или просто вызвать ее напрямую и передать handlerinput
.
const SomeOtherIntentHandler = {
canHandle(handlerInput) {
const request = handlerInput.requestEnvelope.request;
return request.type === 'IntentRequest'
&& request.intent.name === 'SomeOtherIntent';
},
handle(handlerInput) {
// Do your stuff here
// Now to call AMAZON.YesIntent intent handler
return amazonYesIntentHandler.handle(handlerInput);
}
}