From 753c6766a0b28d66105dc1a6684f6ab7bd1b3f96 Mon Sep 17 00:00:00 2001 From: Greg Scher Date: Fri, 20 Mar 2026 16:49:58 -0400 Subject: [PATCH] Remove text truncation limits from Telegram posts Posts were being cut to 300 chars (source ingestion) and 150 chars (alert evaluation), losing valuable OSINT context. The sendMessage chunker already handles the 4096-char Telegram API limit. Co-Authored-By: Claude Opus 4.6 (1M context) --- apis/sources/telegram.mjs | 5 ++--- lib/alerts/telegram.mjs | 2 +- 2 files changed, 3 insertions(+), 4 deletions(-) diff --git a/apis/sources/telegram.mjs b/apis/sources/telegram.mjs index eb65384..c4f6e17 100644 --- a/apis/sources/telegram.mjs +++ b/apis/sources/telegram.mjs @@ -94,7 +94,7 @@ export async function getChat(chatId) { // Compact a Bot API message for briefing output function compactBotMessage(msg) { return { - text: (msg.text || msg.caption || '').slice(0, 300), + text: msg.text || msg.caption || '', date: msg.date ? new Date(msg.date * 1000).toISOString() : null, chat: msg.chat?.title || msg.chat?.username || 'unknown', views: msg.views || 0, @@ -171,8 +171,7 @@ function parseWebPreview(html, channelId) { .replace(/"/g, '"') .replace(/'/g, "'") .replace(/ /g, ' ') - .trim() - .slice(0, 300); + .trim(); } // Extract view count diff --git a/lib/alerts/telegram.mjs b/lib/alerts/telegram.mjs index 4c3ac3a..4288b02 100644 --- a/lib/alerts/telegram.mjs +++ b/lib/alerts/telegram.mjs @@ -681,7 +681,7 @@ Respond with ONLY valid JSON: if (osintSignals.length > 0) { sections.push('📡 OSINT SIGNALS:\n' + osintSignals.map(s => { const post = s.item || s; - return ` [${post.channel || 'UNKNOWN'}] ${(post.text || s.reason || '').substring(0, 150)}`; + return ` [${post.channel || 'UNKNOWN'}] ${post.text || s.reason || ''}`; }).join('\n')); }