JSON.parse the response for quote

This commit is contained in:
Daniel Odendahl Jr
2017-03-23 17:17:29 +00:00
parent 8e3eaf2ae7
commit bcec25b32b
+3 -3
View File
@@ -30,9 +30,9 @@ module.exports = class QuotesCommand extends commando.Command {
cat: randomTypes
})
.then(function(response) {
console.log(response);
console.log(response.body);
return message.channel.send(`"${response.body.quote}"\n - *${response.body.author}*`).catch(error => message.channel.send(':x: Error! Something went wrong!'));
let quoteResponse = JSON.parse(response.text);
console.log(quoteResponse);
return message.channel.send(`"${quoteResponse.quote}"\n - *${quoteResponse.author}*`).catch(error => message.channel.send(':x: Error! Something went wrong!'));
}).catch(function(err) {
console.log(err);
return message.channel.send(":x: Error! Unknown Error. Try again later!");