From b8067bf59e56753b47fd4124eb76e7a3f9accb97 Mon Sep 17 00:00:00 2001 From: Lucas Gabriel Date: Mon, 14 Oct 2024 06:30:55 -0300 Subject: [PATCH] http.cat beta support --- commands/cat.js | 16 ++++++++++++++++ 1 file changed, 16 insertions(+) diff --git a/commands/cat.js b/commands/cat.js index ff8cf1c..feb7416 100644 --- a/commands/cat.js +++ b/commands/cat.js @@ -24,6 +24,22 @@ module.exports = (bot) => { reply_to_message_id: ctx.message.message_id }); }; + } else if (userInput && userInput.includes("http")) { + request = `/${userInput.replace("http", "")}`; + const apiUrl = `https://http.cat${request}`; + + try { + await ctx.replyWithPhoto(apiUrl, { + caption: `🐱`, + parse_mode: 'Markdown', + reply_to_message_id: ctx.message.message_id + }); + } catch (error) { + ctx.reply(Strings.catImgErr, { + parse_mode: 'Markdown', + reply_to_message_id: ctx.message.message_id + }); + }; } else { request = userInput ? `/${userInput}` : ''; const apiUrl = `https://cataas.com/cat${request}`;