Skip to content
This repository was archived by the owner on Apr 29, 2021. It is now read-only.

Commit 060caa2

Browse files
committed
Fixed the rollcall timeout functionality and stop intent handler
1 parent 5cdf172 commit 060caa2

File tree

2 files changed

+10
-6
lines changed

2 files changed

+10
-6
lines changed

lambda/custom/index.js

Lines changed: 9 additions & 6 deletions
Original file line numberDiff line numberDiff line change
@@ -141,6 +141,7 @@ const GlobalHandlers = {
141141
canHandle(handlerInput) {
142142
const { request } = handlerInput.requestEnvelope;
143143
const intentName = request.intent ? request.intent.name : '';
144+
144145
console.log("Global.StopIntentHandler: checking if it can handle "
145146
+ request.type + " for " + intentName);
146147
return request.type === 'IntentRequest'
@@ -149,7 +150,7 @@ const GlobalHandlers = {
149150
handle(handlerInput) {
150151
console.log("Global.StopIntentHandler: handling request");
151152
handlerInput.responseBuilder.speak('Good Bye!')
152-
GlobalHandlers.SessionEndedRequestHandler.handle(handlerInput);
153+
return GlobalHandlers.SessionEndedRequestHandler.handle(handlerInput);
153154
}
154155
},
155156
GameEngineInputHandler: {
@@ -189,11 +190,11 @@ const GlobalHandlers = {
189190
return GamePlay.HandleButtonPressed(handlerInput);
190191
}
191192
break;
192-
case 'timeout':
193-
if (sessionAttributes.state == Settings.SKILL_STATES.ROLL_CALL_MODE) {
194-
return RollCall.HandleTimeout(handlerInput);
195-
} else if (sessionAttributes.state == Settings.SKILL_STATES.PLAY_MODE) {
193+
case 'timeout':
194+
if (sessionAttributes.state == Settings.SKILL_STATES.PLAY_MODE) {
196195
return GamePlay.HandleTimeout(handlerInput);
196+
} else {
197+
RollCall.HandleTimeout(handlerInput);
197198
}
198199
break;
199200
}
@@ -309,7 +310,9 @@ const GlobalHandlers = {
309310
console.log(`Session ended with reason: ${handlerInput.requestEnvelope.request.reason}`);
310311
let response = handlerInput.responseBuilder.getResponse();
311312
response.shouldEndSession = true;
312-
return response;
313+
const ctx = handlerInput.attributesManager.getRequestAttributes();
314+
ctx.outputSpeech = ["Good bye!"];
315+
return handlerInput.responseBuilder.getResponse();
313316
},
314317
},
315318
RequestInterceptor: {

lambda/custom/rollcall.js

Lines changed: 1 addition & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -129,6 +129,7 @@ const RollCall = {
129129
ctx.outputSpeech.push("they're connected and ready for play. ");
130130
ctx.outputSpeech.push("Ok. Press the first button and wait for confirmation");
131131
ctx.outputSpeech.push("before pressing the second button.");
132+
ctx.outputSpeech.push(Settings.WAITING_AUDIO);
132133

133134
ctx.timeout = 50000;
134135

0 commit comments

Comments
 (0)