From aae147f2786a9b5844d0575d48a7444e8602e880 Mon Sep 17 00:00:00 2001 From: Daniel Odendahl Jr Date: Sat, 14 Jul 2018 00:02:08 +0000 Subject: [PATCH] Fix HTTP Cat --- commands/search/http-cat.js | 3 ++- package.json | 2 +- 2 files changed, 3 insertions(+), 2 deletions(-) diff --git a/commands/search/http-cat.js b/commands/search/http-cat.js index e717141c..999068bf 100644 --- a/commands/search/http-cat.js +++ b/commands/search/http-cat.js @@ -21,7 +21,8 @@ module.exports = class HttpCatCommand extends Command { async run(msg, { code }) { try { - const { body } = await request.get(`https://http.cat/${code}.jpg`); + const { body, headers } = await request.get(`https://http.cat/${code}.jpg`); + if (headers['content-type'] === 'text/html') return msg.say('Could not find any results.'); return msg.say({ files: [{ attachment: body, name: `${code}.jpg` }] }); } catch (err) { if (err.status === 404) return msg.say('Could not find any results.'); diff --git a/package.json b/package.json index 137ab149..81fc2ad1 100644 --- a/package.json +++ b/package.json @@ -1,6 +1,6 @@ { "name": "xiao", - "version": "84.4.0", + "version": "84.4.1", "description": "Your personal server companion.", "main": "Xiao.js", "scripts": {