This commit is contained in:
ろむねこ 2024-07-16 12:57:58 +09:00
parent 963f4eb942
commit 2b2f4349a9
Signed by: Fujimatsu
GPG Key ID: FA1F39A1BA37D168

View File

@ -1,6 +1,7 @@
import * as Alexa from 'ask-sdk-core';
import * as AWS from 'aws-sdk';
import * as DynamoDBPersistantAttributesAdapter from 'ask-sdk-dynamodb-persistence-adapter';
import { DialogState } from 'ask-sdk-model';
const LaunchRequestHandler = {
canHandle(handlerInput: Alexa.HandlerInput) {
@ -48,12 +49,16 @@ const KidShiftAuthIntentHandler = {
&& Alexa.getIntentName(handlerInput.requestEnvelope) === 'KidShiftAuthIntent';
},
handle(handlerInput: Alexa.HandlerInput) {
const loginCode = Alexa.getSlot(handlerInput.requestEnvelope, 'loginCode');
const speakOutput = `You entered the code ${loginCode.value}.`;
return handlerInput.responseBuilder
.speak(speakOutput)
.withShouldEndSession(true)
.getResponse();
const dialogState: DialogState = Alexa.getDialogState(handlerInput.requestEnvelope);
if (dialogState !== 'COMPLETED') {
return handlerInput.responseBuilder
.speak('Not provided')
.getResponse();
} else {
return handlerInput.responseBuilder
.speak('Provided')
.getResponse();
}
}
};