I've been having some trouble trying to output speech after getting data using request-reponse and processing it. For whatever reason in the callback function it wont output the text. The console.log(prompt) works yet it the response.say(prompt).shouldEndSession(false).send() doesn't. If you've any idea it'll be greatly appreciated.
test.getNumberStatus(number, function(err, message) {
console.log("In callback outside if statement");
if (err == null) {
console.log(message);
response.say(message).shouldEndSession(false).send();
} else {
console.log("Error");
rresponse.say(message).shouldEndSession(false).send();
}
});
stopInfo.prototype.getStopStatus = function(stopNumber, callback) {
var options = {
method: 'GET',
uri: ENDPOINT + '?stopid=' + stopNumber + '&maxresults=1&format=json',
json: true
};
requestPromise(options).then(function(stopStatusObject) {
if (true) { // check if error from dublin bus
console.log(stopStatusObject);
var template = _.template('busstopinfo <%= error %>');
var message = template({
'error': 'test'
});
callback(null, message);
}
}).catch(function(err) {
var message = "I didn\'t have data for stop number " + stopNumber;
callback(err, message);
});
};
via user3408117
No comments:
Post a Comment