fix(telegram): expand text_link entities in inbound text

Co-Authored-By: Claude Opus 4.5 <noreply@anthropic.com>
This commit is contained in:
Peter Steinberger
2026-01-17 20:41:24 +00:00
parent c2fada7062
commit 63d466fe5e
4 changed files with 90 additions and 1 deletions

View File

@@ -27,6 +27,7 @@ import {
buildTelegramGroupFrom,
buildTelegramGroupPeerId,
buildTypingThreadParams,
expandTextLinks,
normalizeForwardedContext,
describeReplyTarget,
extractTelegramLocation,
@@ -271,7 +272,8 @@ export const buildTelegramMessageContext = async ({
const locationData = extractTelegramLocation(msg);
const locationText = locationData ? formatLocationText(locationData) : undefined;
const rawText = (msg.text ?? msg.caption ?? "").trim();
const rawTextSource = msg.text ?? msg.caption ?? "";
const rawText = expandTextLinks(rawTextSource, msg.entities ?? msg.caption_entities).trim();
let rawBody = [rawText, locationText].filter(Boolean).join("\n").trim();
if (!rawBody) rawBody = placeholder;
if (!rawBody && allMedia.length === 0) return null;