mirror of
https://github.com/r-ca/kidshift-skills.git
synced 2024-10-25 17:14:03 +00:00
テスト用カウント処理追加
This commit is contained in:
parent
33e6e2fbdf
commit
490fca395e
17
src/index.ts
17
src/index.ts
|
@ -21,8 +21,21 @@ const HelloWorldIntentHandler = {
|
|||
return Alexa.getRequestType(handlerInput.requestEnvelope) === 'IntentRequest'
|
||||
&& Alexa.getIntentName(handlerInput.requestEnvelope) === 'HelloWorldIntent';
|
||||
},
|
||||
handle(handlerInput: Alexa.HandlerInput) {
|
||||
const speakOutput = 'Hello World!';
|
||||
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)
|
||||
|
|
Loading…
Reference in New Issue
Block a user