From 3700d9bb58b1a3b6aaad12088eb782e5e90b3959 Mon Sep 17 00:00:00 2001 From: GotPPay Date: Tue, 23 Jan 2018 13:46:02 +0100 Subject: [PATCH] Simulate built-in intents --- backend/helpers/amazon.js | 13 +++++++++++++ backend/models/alexa.js | 13 +++++++------ 2 files changed, 20 insertions(+), 6 deletions(-) diff --git a/backend/helpers/amazon.js b/backend/helpers/amazon.js index fcc781e..107b0a6 100644 --- a/backend/helpers/amazon.js +++ b/backend/helpers/amazon.js @@ -68,6 +68,19 @@ var generateInteractionModel = function (skill) { allIntents.push ({name: intent.intentName, samples: intent.questions}); }); + //Special intents (Amazon built-in don't work, probably something related to existance of dialog intent + allIntents.push ({ + name: 'HelpIntent', + samples: ['Help', 'Can you help me', 'I need help'], + slots: [], + }); + + allIntents.push ({ + name: 'CancelIntent', + samples: ['Cancel', 'Stop', 'Please stop'], + slots: [], + }); + //Special intent for sending message (Dialog) allIntents.push ({ diff --git a/backend/models/alexa.js b/backend/models/alexa.js index d4703a9..d51b051 100644 --- a/backend/models/alexa.js +++ b/backend/models/alexa.js @@ -44,6 +44,7 @@ module.exports = { 'ms"/>'; } }); + listOfPossibleQuestions += 'If you dont know what to do, just say help or stop'; //Handler for launch requestconsole.log() handlers = { @@ -161,20 +162,20 @@ module.exports = { //Built-In intents - handlers['AMAZON.CancelIntent'] = function () { + handlers.CancelIntent = function () { console.log ('Cancel'); this.reponse.speak ('Thank you for using Saburly'); this.emit (':responseReady'); }; - handlers['AMAZON.HelpIntent'] = function () { + handlers.HelpIntent = function () { console.log ('Help'); + this.response + .speak (listOfPossibleQuestions) + .listen (constants.voiceResponseStrings.GENERIC_CONTINUE); //Phrase from listen doesn't work !!! + this.emit (':responseReady'); }; - handlers.HelpIntent = function (){ - console.log('Help'); - } - //Default handlers for unknown questions and session close handlers.Unhandled = function () {