fixed PR #15 comments
This commit is contained in:
@@ -7,6 +7,7 @@ let predefinedSourceHelper = require ('../helpers/externalSource');
|
||||
|
||||
var handlers = {};
|
||||
var destinationEmail;
|
||||
let skillName;
|
||||
|
||||
module.exports = {
|
||||
run: function (req, res) {
|
||||
@@ -33,6 +34,7 @@ module.exports = {
|
||||
.then (activeSkill => {
|
||||
handlers = {};
|
||||
destinationEmail = activeSkill.contactEmail;
|
||||
skillName = activeSkill.invocationName;
|
||||
|
||||
let listOfPossibleQuestions = '';
|
||||
activeSkill.intents.forEach (intent => {
|
||||
@@ -77,7 +79,7 @@ module.exports = {
|
||||
reject: null
|
||||
}
|
||||
|
||||
let answer = new Promise((resolve,reject)=>{
|
||||
let answerPromise = new Promise ((resolve, reject) => {
|
||||
answerPromiseProps = {
|
||||
resolve:resolve,
|
||||
reject:reject
|
||||
@@ -88,30 +90,32 @@ module.exports = {
|
||||
case constants.answerType.PREDEFINED:
|
||||
answerPromiseProps.resolve(intent.answer);
|
||||
break;
|
||||
case constants.answerType.EXTERNAL_SOURCE_WP_JSON:
|
||||
case constants.answerType.EXTERNAL_SOURCE_WP_TITLES:
|
||||
predefinedSourceHelper.getAnswerFromWP(intent.externalAnswerSource).then(answer=>{
|
||||
answerPromiseProps.resolve(answer);
|
||||
}).catch(error=>{
|
||||
answerPromiseProps.reject(error);
|
||||
});
|
||||
break;
|
||||
case constants.answerType.EXTERNAL_SOURCE_RSS:
|
||||
case constants.answerType.EXTERNAL_SOURCE_WP_NEWS:
|
||||
answer = 'Not implemented yet'
|
||||
answerPromiseProps.resolve(answer);
|
||||
break;
|
||||
}
|
||||
|
||||
answer.then(answer=>{
|
||||
this.response
|
||||
.speak (answer)
|
||||
.listen (constants.voiceResponseStrings.GENERIC_CONTINUE); //Phrase from listen doesn't work !!!
|
||||
this.emit (':responseReady');
|
||||
}).catch(error=>{
|
||||
this.response
|
||||
.speak (error)
|
||||
.listen (constants.voiceResponseStrings.GENERIC_CONTINUE); //Phrase from listen doesn't work !!!
|
||||
this.emit (':responseReady');
|
||||
});
|
||||
answerPromise
|
||||
.then (answer => {
|
||||
this.response
|
||||
.speak (answer)
|
||||
.listen (constants.voiceResponseStrings.GENERIC_CONTINUE); //Phrase from listen doesn't work !!!
|
||||
this.emit (':responseReady');
|
||||
})
|
||||
.catch (error => {
|
||||
this.response
|
||||
.speak (error)
|
||||
.listen (constants.voiceResponseStrings.GENERIC_CONTINUE); //Phrase from listen doesn't work !!!
|
||||
this.emit (':responseReady');
|
||||
});
|
||||
};
|
||||
});
|
||||
|
||||
@@ -213,7 +217,7 @@ module.exports = {
|
||||
if (this.attributes['LaunchRequestYesNo']) {
|
||||
this.attributes['LaunchRequestYesNo'] = false;
|
||||
}
|
||||
this.response.speak ('Thank you for using Saburly');
|
||||
this.response.speak (`Thank you for using ${skillName}`);
|
||||
this.emit (':responseReady');
|
||||
};
|
||||
|
||||
|
||||
Reference in New Issue
Block a user