Files
Moltbot/src/plugin-sdk/config-paths.ts
2026-02-15 01:15:43 +00:00

16 lines
668 B
TypeScript

import type { OpenClawConfig } from "../config/config.js";
export function resolveChannelAccountConfigBasePath(params: {
cfg: OpenClawConfig;
channelKey: string;
accountId: string;
}): string {
const channels = params.cfg.channels as unknown as Record<string, unknown> | undefined;
const channelSection = channels?.[params.channelKey] as Record<string, unknown> | undefined;
const accounts = channelSection?.accounts as Record<string, unknown> | undefined;
const useAccountPath = Boolean(accounts?.[params.accountId]);
return useAccountPath
? `channels.${params.channelKey}.accounts.${params.accountId}.`
: `channels.${params.channelKey}.`;
}