experiment with Yes and No intents

This commit is contained in:
GotPPay
2018-01-23 00:20:50 +01:00
parent d58d4b89e3
commit b1a853c363
2 changed files with 28 additions and 10 deletions

View File

@@ -47,24 +47,31 @@ module.exports = {
//Defaul Amazon handlers (some of them)
handlers.NewSession = function () {
this.attributes['WantToHearQuestions'] = false;
this.attributes['WaitingQuestions'] = false;
};
handlers['AMAZON.YesIntent'] = function () {
console.log("yes intent");
if (this.attributes['WantToHearQuestions']) {
if (this.attributes['WaitingQuestions']) {
this.response
.speak (listOfPossibleQuestions)
.listen(listOfPossibleQuestions);
.listen(constants.voiceResponseStrings.GENERIC_CONTINUE);
this.emit(':responseReady');
}
};
handlers['AMAZON.NoIntent'] = function () {
console.log("No intent");
if (this.attributes['WaitingQuestions']) {
this.attributes['WaitingQuestions'] = false;
}
};
//Handler for launch request
handlers = {
LaunchRequest: function () {
this.response
.speak (activeSkill.invocationAnswer)
.speak (activeSkill.invocationAnswer + '<break time="1s"/> Would you like to hear possible questions ?')
.listen (constants.voiceResponseStrings.GENERIC_CONTINUE); //Phrase from listen doesn't work !!!
this.attributes['WantToHearQuestions'] = true;