list all questions on Launch
This commit is contained in:
@@ -34,14 +34,42 @@ module.exports = {
|
||||
handlers = {};
|
||||
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
|
||||
handlers = {
|
||||
LaunchRequest: function () {
|
||||
this.response
|
||||
.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 !!!
|
||||
//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');
|
||||
},
|
||||
};
|
||||
|
||||
Reference in New Issue
Block a user