mirror of
https://github.com/openclaw/openclaw.git
synced 2026-05-06 11:00:42 +00:00
perf: slim telegram bot imports
This commit is contained in:
@@ -9,11 +9,22 @@ 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<TelegramMessageDispatchModule> | undefined;
|
||||
|
||||
async function loadTelegramMessageDispatch(): Promise<TelegramMessageDispatchModule> {
|
||||
telegramMessageDispatchPromise ??= import("./bot-message-dispatch.js");
|
||||
return await telegramMessageDispatchPromise;
|
||||
}
|
||||
|
||||
/** Dependencies injected once when creating the message processor. */
|
||||
type TelegramMessageProcessorDeps = Omit<
|
||||
BuildTelegramMessageContextParams,
|
||||
@@ -108,6 +119,7 @@ export const createTelegramMessageProcessor = (deps: TelegramMessageProcessorDep
|
||||
);
|
||||
}
|
||||
try {
|
||||
const { dispatchTelegramMessage } = await loadTelegramMessageDispatch();
|
||||
await dispatchTelegramMessage({
|
||||
context,
|
||||
bot,
|
||||
|
||||
@@ -4,9 +4,11 @@ import {
|
||||
maybeResolveTextAlias,
|
||||
normalizeCommandBody,
|
||||
} from "openclaw/plugin-sdk/command-auth";
|
||||
import {
|
||||
isAbortRequestText,
|
||||
isBtwRequestText,
|
||||
} from "openclaw/plugin-sdk/command-primitives-runtime";
|
||||
import { parseExecApprovalCommandText } from "openclaw/plugin-sdk/infra-runtime";
|
||||
import { isAbortRequestText } from "openclaw/plugin-sdk/reply-runtime";
|
||||
import { isBtwRequestText } from "openclaw/plugin-sdk/reply-runtime";
|
||||
import { resolveTelegramForumThreadId } from "./bot/helpers.js";
|
||||
|
||||
export type TelegramSequentialKeyContext = {
|
||||
|
||||
Reference in New Issue
Block a user