mirror of
https://github.com/arthur-pbty/xiao.git
synced 2026-06-18 21:40:49 +02:00
JSON.parse the response for quote
This commit is contained in:
@@ -30,9 +30,9 @@ module.exports = class QuotesCommand extends commando.Command {
|
|||||||
cat: randomTypes
|
cat: randomTypes
|
||||||
})
|
})
|
||||||
.then(function(response) {
|
.then(function(response) {
|
||||||
console.log(response);
|
let quoteResponse = JSON.parse(response.text);
|
||||||
console.log(response.body);
|
console.log(quoteResponse);
|
||||||
return message.channel.send(`"${response.body.quote}"\n - *${response.body.author}*`).catch(error => message.channel.send(':x: Error! Something went wrong!'));
|
return message.channel.send(`"${quoteResponse.quote}"\n - *${quoteResponse.author}*`).catch(error => message.channel.send(':x: Error! Something went wrong!'));
|
||||||
}).catch(function(err) {
|
}).catch(function(err) {
|
||||||
console.log(err);
|
console.log(err);
|
||||||
return message.channel.send(":x: Error! Unknown Error. Try again later!");
|
return message.channel.send(":x: Error! Unknown Error. Try again later!");
|
||||||
|
|||||||
Reference in New Issue
Block a user