refactor(telegram): centralize text parsing helpers

This commit is contained in:
Peter Steinberger
2026-03-08 02:03:37 +00:00
parent 6a8081a7f3
commit e7056272bc
4 changed files with 110 additions and 16 deletions

View File

@@ -48,6 +48,7 @@ import {
} from "./bot-updates.js";
import { resolveMedia } from "./bot/delivery.js";
import {
getTelegramTextParts,
buildTelegramGroupPeerId,
buildTelegramParentPeer,
resolveTelegramForumThreadId,
@@ -1008,7 +1009,7 @@ export const registerTelegramHandlers = ({
// Skip sticker-only messages where the sticker was skipped (animated/video)
// These have no media and no text content to process.
const hasText = Boolean((msg.text ?? msg.caption ?? "").trim());
const hasText = Boolean(getTelegramTextParts(msg).text.trim());
if (msg.sticker && !media && !hasText) {
logVerbose("telegram: skipping sticker-only message (unsupported sticker type)");
return;