experiment with yes intent
This commit is contained in:
@@ -12,7 +12,6 @@ module.exports = {
|
|||||||
// Build the context manually, because Amazon Lambda is missing
|
// Build the context manually, because Amazon Lambda is missing
|
||||||
var context = {
|
var context = {
|
||||||
succeed: function (result) {
|
succeed: function (result) {
|
||||||
console.log (result);
|
|
||||||
res.json (result);
|
res.json (result);
|
||||||
},
|
},
|
||||||
fail: function (error) {
|
fail: function (error) {
|
||||||
@@ -34,6 +33,17 @@ module.exports = {
|
|||||||
handlers = {};
|
handlers = {};
|
||||||
destinationEmail = activeSkill.contactEmail;
|
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)
|
//Defaul Amazon handlers (some of them)
|
||||||
|
|
||||||
handlers.NewSession = function () {
|
handlers.NewSession = function () {
|
||||||
@@ -41,16 +51,8 @@ module.exports = {
|
|||||||
};
|
};
|
||||||
|
|
||||||
handlers['AMAZON.YesIntent'] = function () {
|
handlers['AMAZON.YesIntent'] = function () {
|
||||||
|
console.log("yes intent");
|
||||||
if (this.attributes['WantToHearQuestions']) {
|
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
|
this.response
|
||||||
.speak (listOfPossibleQuestions)
|
.speak (listOfPossibleQuestions)
|
||||||
.listen(listOfPossibleQuestions);
|
.listen(listOfPossibleQuestions);
|
||||||
@@ -63,9 +65,6 @@ module.exports = {
|
|||||||
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 !!!
|
||||||
|
|
||||||
this.attributes['WantToHearQuestions'] = true;
|
this.attributes['WantToHearQuestions'] = true;
|
||||||
|
|||||||
Reference in New Issue
Block a user