From 982d3ea2871860f9069a13cdbc69bbffba18b04c Mon Sep 17 00:00:00 2001 From: =?UTF-8?q?Mat=C4=9Bj=20Volf?= Date: Wed, 13 Mar 2024 21:49:57 +0100 Subject: [PATCH] 404 man detection --- tgbot.deno.ts | 49 ++++++++++++++++++++++++++++++++++++------------- 1 file changed, 36 insertions(+), 13 deletions(-) diff --git a/tgbot.deno.ts b/tgbot.deno.ts index 70bdd25..757e53d 100644 --- a/tgbot.deno.ts +++ b/tgbot.deno.ts @@ -249,7 +249,10 @@ async function processTgUpdate(data: any) { }); } - if (text.toLowerCase().includes("regiojet") || text.toLowerCase().includes("php")) { + if ( + text.toLowerCase().includes("regiojet") || + text.toLowerCase().includes("php") + ) { await fetch(`https://api.telegram.org/bot${token}/deleteMessage`, { method: "POST", headers: { @@ -398,20 +401,40 @@ Be grateful for your abilities and your incredible success and your considerable text = "```\n" + manText.replaceAll("```", "`´`") + "```"; parse_mode = "MarkdownV2"; } + } else if (response.status === 404) { + text = ""; + await fetch(`https://api.telegram.org/bot${token}/setMessageReaction`, { + method: "POST", + headers: { + "Content-Type": "application/json", + }, + body: JSON.stringify({ + chat_id: data.message.chat.id, + message_id: data.message.message_id, + is_big: true, + reaction: [ + { + type: "emoji", + emoji: "🤷‍♂️", + }, + ], + }), + }); } - await fetch(`https://api.telegram.org/bot${token}/sendMessage`, { - method: "POST", - headers: { - "Content-Type": "application/json", - }, - body: JSON.stringify({ - chat_id: data.message.chat.id, - reply_to_message_id: data.message.message_id, - text, - parse_mode, - }), - }); + if (text) + await fetch(`https://api.telegram.org/bot${token}/sendMessage`, { + method: "POST", + headers: { + "Content-Type": "application/json", + }, + body: JSON.stringify({ + chat_id: data.message.chat.id, + reply_to_message_id: data.message.message_id, + text, + parse_mode, + }), + }); } if (text.toLowerCase().includes("sus")) {