experiment with yes intent
This commit is contained in:
@@ -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] +
|
||||
'<break time="1s"/>';
|
||||
}
|
||||
});
|
||||
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] +
|
||||
'<break time="1s"/>';
|
||||
}
|
||||
});
|
||||
this.response
|
||||
.speak (listOfPossibleQuestions)
|
||||
.listen(listOfPossibleQuestions);
|
||||
@@ -63,9 +65,6 @@ module.exports = {
|
||||
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 !!!
|
||||
|
||||
this.attributes['WantToHearQuestions'] = true;
|
||||
|
||||
Reference in New Issue
Block a user