Revert "test"

This reverts commit 6fea88092b.
This commit is contained in:
ろむねこ 2024-07-16 09:53:48 +09:00
parent a2b00d854f
commit 1ed32c9a2c
Signed by: Fujimatsu
GPG Key ID: FA1F39A1BA37D168

View File

@ -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();