mirror of
https://github.com/arthur-pbty/xiao.git
synced 2026-06-12 00:04:48 +02:00
Illegal, Karen, better ping
This commit is contained in:
@@ -21,8 +21,8 @@ module.exports = class HTTPCatCommand extends Command {
|
||||
|
||||
async run(msg, { code }) {
|
||||
try {
|
||||
const { body, text } = await snekfetch.get(`https://http.cat/${code}.jpg`);
|
||||
if (text.startsWith('<!DOCTYPE html>')) return msg.say('Could not find any results.');
|
||||
const { body, headers } = await snekfetch.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) {
|
||||
return msg.reply(`Oh no, an error occurred: \`${err.message}\`. Try again later!`);
|
||||
|
||||
Reference in New Issue
Block a user