From d58d4b89e3b33342b292d9fe85e3171b97e9c55c Mon Sep 17 00:00:00 2001 From: GotPPay Date: Tue, 23 Jan 2018 00:08:39 +0100 Subject: [PATCH] experiment with yes intent --- backend/models/alexa.js | 25 ++++++++++++------------- 1 file changed, 12 insertions(+), 13 deletions(-) diff --git a/backend/models/alexa.js b/backend/models/alexa.js index 0ff79d8..271b528 100644 --- a/backend/models/alexa.js +++ b/backend/models/alexa.js @@ -12,7 +12,6 @@ module.exports = { // Build the context manually, because Amazon Lambda is missing var context = { succeed: function (result) { - console.log (result); res.json (result); }, fail: function (error) { @@ -34,6 +33,17 @@ module.exports = { handlers = {}; destinationEmail = activeSkill.contactEmail; + let listOfPossibleQuestions = ''; + activeSkill.intents.map (intent => { + if (intent.questions.length > 0) { + listOfPossibleQuestions += + intent.intentExplanation + + intent.questions[0] + + ''; + } + }); + console.log(listOfPossibleQuestions); + //Defaul Amazon handlers (some of them) handlers.NewSession = function () { @@ -41,16 +51,8 @@ module.exports = { }; handlers['AMAZON.YesIntent'] = function () { + console.log("yes intent"); if (this.attributes['WantToHearQuestions']) { - let listOfPossibleQuestions = ''; - activeSkill.intents.map (intent => { - if (intent.questions.length > 0) { - listOfPossibleQuestions += - intent.intentExplanation + - intent.questions[0] + - ''; - } - }); this.response .speak (listOfPossibleQuestions) .listen(listOfPossibleQuestions); @@ -63,9 +65,6 @@ module.exports = { LaunchRequest: function () { this.response .speak (activeSkill.invocationAnswer) - .speak ( - 'Would you like to hear questions that you can ask me ?' - ) .listen (constants.voiceResponseStrings.GENERIC_CONTINUE); //Phrase from listen doesn't work !!! this.attributes['WantToHearQuestions'] = true;