Fix HTTP Cat

This commit is contained in:
Daniel Odendahl Jr
2018-07-14 00:02:08 +00:00
parent 4eb4885b6c
commit aae147f278
2 changed files with 3 additions and 2 deletions
+2 -1
View File
@@ -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.');
+1 -1
View File
@@ -1,6 +1,6 @@
{
"name": "xiao",
"version": "84.4.0",
"version": "84.4.1",
"description": "Your personal server companion.",
"main": "Xiao.js",
"scripts": {