refactor: split telegram delivery and unify media/frontmatter/i18n pipelines

This commit is contained in:
Peter Steinberger
2026-03-02 04:12:23 +00:00
parent 706cfcd54f
commit e1f3ded033
15 changed files with 1239 additions and 925 deletions

View File

@@ -12,6 +12,7 @@ import { Routes, type APIChannel, type APIEmbed } from "discord-api-types/v10";
import type { ChunkMode } from "../auto-reply/chunk.js";
import { loadConfig } from "../config/config.js";
import type { RetryRunner } from "../infra/retry-policy.js";
import { buildOutboundMediaLoadOptions } from "../media/load-options.js";
import { normalizePollDurationHours, normalizePollInput, type PollInput } from "../polls.js";
import { loadWebMedia } from "../web/media.js";
import { resolveDiscordAccount } from "./accounts.js";
@@ -420,7 +421,7 @@ async function sendDiscordMedia(
chunkMode?: ChunkMode,
silent?: boolean,
) {
const media = await loadWebMedia(mediaUrl, { localRoots: mediaLocalRoots });
const media = await loadWebMedia(mediaUrl, buildOutboundMediaLoadOptions({ mediaLocalRoots }));
const chunks = text ? buildDiscordTextChunks(text, { maxLinesPerMessage, chunkMode }) : [];
const caption = chunks[0] ?? "";
const messageReference = replyTo ? { message_id: replyTo, fail_if_not_exists: false } : undefined;