list all questions on Launch
This commit is contained in:
@@ -34,14 +34,42 @@ module.exports = {
|
|||||||
handlers = {};
|
handlers = {};
|
||||||
destinationEmail = activeSkill.contactEmail;
|
destinationEmail = activeSkill.contactEmail;
|
||||||
|
|
||||||
|
//Defaul Amazon handlers (some of them)
|
||||||
|
|
||||||
|
handlers.NewSession = function () {
|
||||||
|
this.attributes['WantToHearQuestions'] = false;
|
||||||
|
};
|
||||||
|
|
||||||
|
handlers['AMAZON.YesIntent'] = function () {
|
||||||
|
if (this.attributes['WantToHearQuestions']) {
|
||||||
|
let listOfPossibleQuestions = '';
|
||||||
|
activeSkill.intents.map (intent => {
|
||||||
|
if (intent.questions.length > 0) {
|
||||||
|
listOfPossibleQuestions +=
|
||||||
|
intent.intentExplanation +
|
||||||
|
intent.questions[0] +
|
||||||
|
'<break time="1s"/>';
|
||||||
|
}
|
||||||
|
});
|
||||||
|
this.response
|
||||||
|
.speak (listOfPossibleQuestions)
|
||||||
|
.listen(listOfPossibleQuestions);
|
||||||
|
this.emit(':responseReady');
|
||||||
|
}
|
||||||
|
};
|
||||||
|
|
||||||
//Handler for launch request
|
//Handler for launch request
|
||||||
handlers = {
|
handlers = {
|
||||||
LaunchRequest: function () {
|
LaunchRequest: function () {
|
||||||
this.response
|
this.response
|
||||||
.speak (activeSkill.invocationAnswer)
|
.speak (activeSkill.invocationAnswer)
|
||||||
|
.speak (
|
||||||
|
'<break time="1s"/>Would you like to hear questions that you can ask me ?'
|
||||||
|
)
|
||||||
.listen (constants.voiceResponseStrings.GENERIC_CONTINUE); //Phrase from listen doesn't work !!!
|
.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.attributes['WantToHearQuestions'] = true;
|
||||||
|
|
||||||
this.emit (':responseReady');
|
this.emit (':responseReady');
|
||||||
},
|
},
|
||||||
};
|
};
|
||||||
|
|||||||
Reference in New Issue
Block a user