mirror of
https://github.com/openclaw/openclaw.git
synced 2026-04-06 14:51:08 +00:00
33 lines
961 B
TypeScript
33 lines
961 B
TypeScript
import { getBundledChannelContractSurfaceModule } from "../channels/plugins/contract-surfaces.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,
|
|
);
|
|
}
|