






















@@ -9,11 +9,22 @@ import {
99type TelegramMediaRef,
1010} from "./bot-message-context.js";
1111import type { TelegramMessageContextOptions } from "./bot-message-context.types.js";
12-import { dispatchTelegramMessage } from "./bot-message-dispatch.js";
1312import type { TelegramBotOptions } from "./bot.types.js";
1413import { buildTelegramThreadParams } from "./bot/helpers.js";
1514import type { TelegramContext, TelegramStreamMode } from "./bot/types.js";
161516+type TelegramMessageDispatchModule = Pick<
17+typeof import("./bot-message-dispatch.js"),
18+"dispatchTelegramMessage"
19+>;
20+21+let telegramMessageDispatchPromise: Promise<TelegramMessageDispatchModule> | undefined;
22+23+async function loadTelegramMessageDispatch(): Promise<TelegramMessageDispatchModule> {
24+telegramMessageDispatchPromise ??= import("./bot-message-dispatch.js");
25+return await telegramMessageDispatchPromise;
26+}
27+1728/** Dependencies injected once when creating the message processor. */
1829type TelegramMessageProcessorDeps = Omit<
1930BuildTelegramMessageContextParams,
@@ -108,6 +119,7 @@ export const createTelegramMessageProcessor = (deps: TelegramMessageProcessorDep
108119);
109120}
110121try {
122+const { dispatchTelegramMessage } = await loadTelegramMessageDispatch();
111123await dispatchTelegramMessage({
112124 context,
113125 bot,
此内容由惯性聚合(RSS阅读器)自动聚合整理,仅供阅读参考。 原文来自 — 版权归原作者所有。