Merge pull request #12 from GotPPay/question-explanation

Question explanation
This commit is contained in:
MirnaM
2018-01-23 12:19:14 +01:00
committed by GitHub
8 changed files with 347 additions and 161 deletions

View File

@@ -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,14 +33,32 @@ module.exports = {
handlers = {};
destinationEmail = activeSkill.contactEmail;
//Handler for launch request
let listOfPossibleQuestions = '';
activeSkill.intents.forEach(intent => {
if (intent.questions.length > 0 && intent.intentExplanation) {
listOfPossibleQuestions +=
intent.intentExplanation +
intent.questions[0] +
'<break time="' +
constants.voiceResponseTimings.PAUSE_BETWEEN_QUESTIONS +
'ms"/>';
}
});
console.log(listOfPossibleQuestions);
//Handler for launch requestconsole.log()
handlers = {
LaunchRequest: function () {
this.response
.speak (activeSkill.invocationAnswer)
.speak (
activeSkill.invocationAnswer +
'<break time="' +
constants.voiceResponseTimings.PAUSE_AFTER_WELCOME_MESSAGE +
'ms"/>' +
listOfPossibleQuestions
)
.listen (constants.voiceResponseStrings.GENERIC_CONTINUE); //Phrase from listen doesn't work !!!
//TODO : Maybe to ask user does he want to hear possible intents
//For this functionality, we need explanation text for each intent (Question)
this.emit (':responseReady');
},
};