mirror of
https://github.com/openclaw/openclaw.git
synced 2026-04-08 07:41:08 +00:00
refactor(channels): move bootstrap channel logic behind extension seams
This commit is contained in:
@@ -1,6 +1,6 @@
|
||||
import { getBundledChannelContractSurfaceModule } from "../channels/plugins/contract-surfaces.js";
|
||||
import type { OpenClawConfig } from "../config/config.js";
|
||||
import { resolveDmGroupAccessWithLists } from "../security/dm-policy-shared.js";
|
||||
export { buildCommandsPaginationKeyboard } from "../../extensions/telegram/api.js";
|
||||
export {
|
||||
createPreCryptoDirectDmAuthorizer,
|
||||
resolveInboundDirectDmAccessWithRuntime,
|
||||
@@ -86,6 +86,37 @@ export {
|
||||
buildHelpMessage,
|
||||
} from "../auto-reply/status.js";
|
||||
|
||||
type TelegramCommandUiContract = {
|
||||
buildCommandsPaginationKeyboard: (
|
||||
currentPage: number,
|
||||
totalPages: number,
|
||||
agentId?: string,
|
||||
) => Array<Array<{ text: string; callback_data: string }>>;
|
||||
};
|
||||
|
||||
function loadTelegramCommandUiContract(): TelegramCommandUiContract {
|
||||
const contract = getBundledChannelContractSurfaceModule<TelegramCommandUiContract>({
|
||||
pluginId: "telegram",
|
||||
preferredBasename: "contract-api.ts",
|
||||
});
|
||||
if (!contract) {
|
||||
throw new Error("telegram command ui contract surface is unavailable");
|
||||
}
|
||||
return contract;
|
||||
}
|
||||
|
||||
export function buildCommandsPaginationKeyboard(
|
||||
currentPage: number,
|
||||
totalPages: number,
|
||||
agentId?: string,
|
||||
): Array<Array<{ text: string; callback_data: string }>> {
|
||||
return loadTelegramCommandUiContract().buildCommandsPaginationKeyboard(
|
||||
currentPage,
|
||||
totalPages,
|
||||
agentId,
|
||||
);
|
||||
}
|
||||
|
||||
export type ResolveSenderCommandAuthorizationParams = {
|
||||
cfg: OpenClawConfig;
|
||||
rawBody: string;
|
||||
|
||||
Reference in New Issue
Block a user