diff --git a/extensions/telegram/src/bot-message.ts b/extensions/telegram/src/bot-message.ts index 6bd6e0e64a4..6ab4cfbd015 100644 --- a/extensions/telegram/src/bot-message.ts +++ b/extensions/telegram/src/bot-message.ts @@ -9,22 +9,11 @@ import { type TelegramMediaRef, } from "./bot-message-context.js"; import type { TelegramMessageContextOptions } from "./bot-message-context.types.js"; +import { dispatchTelegramMessage } from "./bot-message-dispatch.js"; import type { TelegramBotOptions } from "./bot.types.js"; import { buildTelegramThreadParams } from "./bot/helpers.js"; import type { TelegramContext, TelegramStreamMode } from "./bot/types.js"; -type TelegramMessageDispatchModule = Pick< - typeof import("./bot-message-dispatch.js"), - "dispatchTelegramMessage" ->; - -let telegramMessageDispatchPromise: Promise | undefined; - -async function loadTelegramMessageDispatch(): Promise { - telegramMessageDispatchPromise ??= import("./bot-message-dispatch.js"); - return await telegramMessageDispatchPromise; -} - /** Dependencies injected once when creating the message processor. */ type TelegramMessageProcessorDeps = Omit< BuildTelegramMessageContextParams, @@ -119,7 +108,6 @@ export const createTelegramMessageProcessor = (deps: TelegramMessageProcessorDep ); } try { - const { dispatchTelegramMessage } = await loadTelegramMessageDispatch(); await dispatchTelegramMessage({ context, bot,