From 61006d393650d08c50ca41aa2c21247b8f870ec8 Mon Sep 17 00:00:00 2001 From: =?UTF-8?q?Prokop=20Rand=C3=A1=C4=8Dek?= Date: Thu, 29 Jan 2026 21:08:14 +0100 Subject: [PATCH] bla bla --- src/tg/bot.deno.ts | 17 +++++++++++++---- src/tg/init.deno.ts | 2 +- src/tg/utils.deno.ts | 7 ++++++- 3 files changed, 20 insertions(+), 6 deletions(-) diff --git a/src/tg/bot.deno.ts b/src/tg/bot.deno.ts index d7b2fb6..54c4d56 100644 --- a/src/tg/bot.deno.ts +++ b/src/tg/bot.deno.ts @@ -8,12 +8,12 @@ import { BOT_TOKEN, DOMAIN, genRandomToken, - řekniTomovi, getFileBase64, MAIN_CHAT_ID, STICEKR_SET_NAME, STICEKR_SET_OWNER, tgCall, + řekniTomovi, } from "./utils.deno.ts"; import { checkStickerReaction, getTempDir } from "./init.deno.ts"; @@ -196,7 +196,9 @@ export async function* handleTgUpdate(data: any) { ); } - if (text.toLowerCase().includes("arch") && text.toLowerCase().includes("instal")) { + if ( + text.toLowerCase().includes("arch") && text.toLowerCase().includes("instal") + ) { await tgCall({ chat_id: data.message.chat.id, text: `Rád přeinstalovávám Arch Linux opakovaně @@ -347,8 +349,15 @@ Be grateful for your abilities and your incredible success and your considerable const trig = "/řekni_tomovi"; if (text.startsWith(trig) && data.message.chat.id === MAIN_CHAT_ID) { - const image = await getFileBase64(data.message.reply_to_message ?? data.message); - řekniTomovi(data.message.from.first_name, text.slice(trig.length).trim(), image, data.message.chat.id); + const image = await getFileBase64( + data.message.reply_to_message ?? data.message, + ); + řekniTomovi( + data.message.from.first_name, + text.slice(trig.length).trim(), + image, + data.message.chat.id, + ); } if ( diff --git a/src/tg/init.deno.ts b/src/tg/init.deno.ts index bc05fd5..4ead4e2 100644 --- a/src/tg/init.deno.ts +++ b/src/tg/init.deno.ts @@ -255,7 +255,7 @@ export async function init() { ); setTimeout(async () => { - const username = ''; + const username = ""; const name = users[username] ?? "Nějakej impostor"; await tgCall({ chat_id: MAIN_CHAT_ID, diff --git a/src/tg/utils.deno.ts b/src/tg/utils.deno.ts index f7b9e7a..674bab5 100644 --- a/src/tg/utils.deno.ts +++ b/src/tg/utils.deno.ts @@ -44,7 +44,12 @@ export async function tgCall( endpoint = "sendMessage", retryCount = 0, ): Promise { - if (endpoint == "sendMessage") options.chat_id ??= MAIN_CHAT_ID; + if (endpoint == "sendMessage") { + options.chat_id ??= MAIN_CHAT_ID; + options.text = options.text?.length > 64 + ? options.text.slice(0, 64) + " bla bla" + : options.text; + } const maxRetries = 5; const baseDelay = 1000; // 1 second