diff --git a/commands/search/safebooru.js b/commands/search/safebooru.js index 2a06fc51..250f014d 100644 --- a/commands/search/safebooru.js +++ b/commands/search/safebooru.js @@ -22,7 +22,7 @@ module.exports = class SafebooruCommand extends Command { async run(msg, { query }) { try { - const { body } = await snekfetch + const { text } = await snekfetch .get('https://safebooru.org/index.php') .query({ page: 'dapi', @@ -32,7 +32,8 @@ module.exports = class SafebooruCommand extends Command { tags: query, limit: 200 }); - if (!body) return msg.say('Could not find any results.'); + if (!text) return msg.say('Could not find any results.'); + const body = JSON.parse(text); const data = body[Math.floor(Math.random() * body.length)]; return msg.say(`https://safebooru.org/images/${data.directory}/${data.image}`); } catch (err) {