mirror of
https://github.com/r-ca/kidshift-skills.git
synced 2024-10-25 17:14:03 +00:00
parent
a2b00d854f
commit
1ed32c9a2c
43
src/index.ts
43
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();
|
||||
|
|
Loading…
Reference in New Issue
Block a user