Files
openclaw/extensions/discord/src/audit.ts
2026-05-10 12:37:10 +01:00

33 lines
1011 B
TypeScript

import type { OpenClawConfig } from "openclaw/plugin-sdk/config-contracts";
import { inspectDiscordAccount } from "./account-inspect.js";
import {
auditDiscordChannelPermissionsWithFetcher,
collectDiscordAuditChannelIdsForAccount,
type DiscordChannelPermissionsAudit,
} from "./audit-core.js";
import { fetchChannelPermissionsDiscord } from "./send.js";
export function collectDiscordAuditChannelIds(params: {
cfg: OpenClawConfig;
accountId?: string | null;
}) {
const account = inspectDiscordAccount({
cfg: params.cfg,
accountId: params.accountId,
});
return collectDiscordAuditChannelIdsForAccount(account.config);
}
export async function auditDiscordChannelPermissions(params: {
cfg: OpenClawConfig;
token: string;
accountId?: string | null;
channelIds: string[];
timeoutMs: number;
}): Promise<DiscordChannelPermissionsAudit> {
return await auditDiscordChannelPermissionsWithFetcher({
...params,
fetchChannelPermissions: fetchChannelPermissionsDiscord,
});
}