From baf988b5b6d273f9d1ecae61e9c1b51d809ab0f2 Mon Sep 17 00:00:00 2001 From: Luquinhas Date: Thu, 21 Nov 2024 12:16:18 -0300 Subject: [PATCH] Put /httpcat into http.js --- commands/cat.js | 27 --------------------------- commands/http.js | 27 +++++++++++++++++++++++++++ 2 files changed, 27 insertions(+), 27 deletions(-) diff --git a/commands/cat.js b/commands/cat.js index 6f7b946..ff8cf1c 100644 --- a/commands/cat.js +++ b/commands/cat.js @@ -42,31 +42,4 @@ module.exports = (bot) => { }; }; }); - - bot.command("httpcat", spamwatchMiddleware, async (ctx) => { - const Strings = getStrings(ctx.from.language_code); - const userInput = ctx.message.text.split(' ').slice(1).join(' ').replace(/\s+/g, ''); - - if (!userInput || isNaN(userInput)) { - return ctx.reply(Strings.catImgErr, { - parse_mode: 'Markdown', - reply_to_message_id: ctx.message.message_id - }); - } - - const apiUrl = `https://http.cat/${userInput}`; - - try { - await ctx.replyWithPhoto(apiUrl, { - caption: `🐱 ${apiUrl}`, - 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 - }); - } - }); }; diff --git a/commands/http.js b/commands/http.js index 71a26af..3b4850d 100644 --- a/commands/http.js +++ b/commands/http.js @@ -45,4 +45,31 @@ module.exports = (bot) => { }); }; }); + + bot.command("httpcat", spamwatchMiddleware, async (ctx) => { + const Strings = getStrings(ctx.from.language_code); + const userInput = ctx.message.text.split(' ').slice(1).join(' ').replace(/\s+/g, ''); + + if (!userInput || isNaN(userInput)) { + return ctx.reply(Strings.catImgErr, { + parse_mode: 'Markdown', + reply_to_message_id: ctx.message.message_id + }); + } + + const apiUrl = `https://http.cat/${userInput}`; + + try { + await ctx.replyWithPhoto(apiUrl, { + caption: `🐱 ${apiUrl}`, + 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 + }); + } + }); };