From 14d5c19b57d31db0f6ad5322506af50b624f6872 Mon Sep 17 00:00:00 2001 From: Rick Wargo Date: Fri, 16 Dec 2016 11:47:16 -0500 Subject: [PATCH] Standard AMAZON handlers for intents without state If an intent occurs without state, ensure the standard handlers (No, Cancel, Stop) are handled, and if any remain unhandled, handle them. --- src/index.js | 21 +++++++++++++++++++++ 1 file changed, 21 insertions(+) diff --git a/src/index.js b/src/index.js index 1a76aa8..0e88624 100644 --- a/src/index.js +++ b/src/index.js @@ -82,6 +82,27 @@ var newSessionHandlers = { this.handler.state = states.SEARCHMODE; this.emit(':ask', skillName + " " + welcomeMessage, welcomeMessage); }, + + 'AMAZON.StopIntent': function () { + this.emit(':tell', killSkillMessage); + }, + + 'AMAZON.CancelIntent': function () { + this.emit(':tell', killSkillMessage); + }, + + 'AMAZON.NoIntent': function () { + this.emit(':tell', shutdownMessage); + }, + + 'SessionEndedRequest': function () { + this.emit('AMAZON.StopIntent'); + }, + + 'Unhandled': function () { + // This occurs if there is no state defined. + this.emit(':ask', HelpMessage, HelpMessage); + } }; // Create a new handler with a SEARCH state