Files
openclaw/extensions/telegram/src/bot-native-command-deps.runtime.ts
2026-07-26 23:15:06 -05:00

59 lines
2.2 KiB
TypeScript

import { dispatchChannelInboundTurn } from "openclaw/plugin-sdk/channel-inbound";
import { readChannelAllowFromStore } from "openclaw/plugin-sdk/conversation-runtime";
import { getPluginCommandSpecs } from "openclaw/plugin-sdk/plugin-runtime";
// Telegram plugin module implements bot native command deps behavior.
import type {
ModelsAuthLoginFlowOptions,
ModelsAuthLoginFlowResult,
} from "openclaw/plugin-sdk/provider-auth-login-flow-runtime";
import { getRuntimeConfig } from "openclaw/plugin-sdk/runtime-config-snapshot";
import { listSkillCommandsForAgents } from "openclaw/plugin-sdk/skill-commands-runtime";
import type { TelegramBotDeps } from "./bot-deps.js";
import { syncTelegramMenuCommands } from "./bot-native-command-menu.js";
import { loadTelegramSendModule } from "./send-runtime.js";
export type TelegramNativeCommandDeps = Pick<
TelegramBotDeps,
| "editMessageTelegram"
| "getRuntimeConfig"
| "listSkillCommandsForAgents"
| "readChannelAllowFromStore"
| "syncTelegramMenuCommands"
> & {
dispatchChannelInboundTurn?: typeof dispatchChannelInboundTurn;
getPluginCommandSpecs?: typeof getPluginCommandSpecs;
runModelsAuthLoginFlow?: (opts: ModelsAuthLoginFlowOptions) => Promise<ModelsAuthLoginFlowResult>;
};
export const defaultTelegramNativeCommandDeps: TelegramNativeCommandDeps & {
dispatchChannelInboundTurn: typeof dispatchChannelInboundTurn;
} = {
get getRuntimeConfig() {
return getRuntimeConfig;
},
get readChannelAllowFromStore() {
return readChannelAllowFromStore;
},
get dispatchChannelInboundTurn() {
return dispatchChannelInboundTurn;
},
get listSkillCommandsForAgents() {
return listSkillCommandsForAgents;
},
get syncTelegramMenuCommands() {
return syncTelegramMenuCommands;
},
get getPluginCommandSpecs() {
return getPluginCommandSpecs;
},
async runModelsAuthLoginFlow(opts) {
const { runModelsAuthLoginFlow } =
await import("openclaw/plugin-sdk/provider-auth-login-flow-runtime");
return await runModelsAuthLoginFlow(opts);
},
async editMessageTelegram(...args) {
const { editMessageTelegram } = await loadTelegramSendModule();
return await editMessageTelegram(...args);
},
};