From 1ed32c9a2cc3a5d05dcbc54a0297546538027305 Mon Sep 17 00:00:00 2001 From: =?UTF-8?q?=E3=82=8D=E3=82=80=E3=81=AD=E3=81=93?= Date: Tue, 16 Jul 2024 09:53:48 +0900 Subject: [PATCH] Revert "test" This reverts commit 6fea88092b2c68f4b25dd97aca2834fec4b2853b. --- src/index.ts | 43 ++++++++++++++++++++----------------------- 1 file changed, 20 insertions(+), 23 deletions(-) diff --git a/src/index.ts b/src/index.ts index 1ff547b..8cef7ae 100644 --- a/src/index.ts +++ b/src/index.ts @@ -23,25 +23,22 @@ const HelloWorldIntentHandler = { }, async handle(handlerInput: Alexa.HandlerInput) { - // const attributesManager = handlerInput.attributesManager; - // const attributes = await attributesManager.getPersistentAttributes(); - // if (!attributes.counter) { - // attributes.counter = 0; - // } else { - // attributes.counter += 1; - // } - // - // attributesManager.setPersistentAttributes(attributes); - // - // await attributesManager.savePersistentAttributes(); - // - // const speakOutput = `Hello World! You've visited this skill ${attributes.counter} times.`; - // - // return handlerInput.responseBuilder - // .speak(speakOutput) - // .getResponse(); + const attributesManager = handlerInput.attributesManager; + const attributes = await attributesManager.getPersistentAttributes(); + if (!attributes.counter) { + attributes.counter = 0; + } else { + attributes.counter += 1; + } + + attributesManager.setPersistentAttributes(attributes); + + await attributesManager.savePersistentAttributes(); + + const speakOutput = `Hello World! You've visited this skill ${attributes.counter} times.`; + return handlerInput.responseBuilder - .speak('Hello World! placeholder message') + .speak(speakOutput) .getResponse(); } }; @@ -155,10 +152,10 @@ exports.handler = Alexa.SkillBuilders.custom() IntentReflectorHandler) .addErrorHandlers( ErrorHandler) - // .withPersistenceAdapter(new DynamoDBPersistantAttributesAdapter.DynamoDbPersistenceAdapter({ - // tableName: process.env.DYNAMODB_PERSISTENCE_TABLE_NAME || 'ask-sdk-table', - // createTable: false, - // dynamoDBClient: new AWS.DynamoDB({apiVersion: 'latest', region: process.env.DYNAMODB_PERSISTENCE_REGION}) - // })) + .withPersistenceAdapter(new DynamoDBPersistantAttributesAdapter.DynamoDbPersistenceAdapter({ + tableName: process.env.DYNAMODB_PERSISTENCE_TABLE_NAME || 'ask-sdk-table', + createTable: false, + dynamoDBClient: new AWS.DynamoDB({apiVersion: 'latest', region: process.env.DYNAMODB_PERSISTENCE_REGION}) + })) .withCustomUserAgent('sample/hello-world/v1.2') .lambda();