mirror of
https://github.com/openclaw/openclaw.git
synced 2026-06-06 05:51:15 +08:00
34 lines
1.0 KiB
TypeScript
34 lines
1.0 KiB
TypeScript
// Discord plugin module implements audit behavior.
|
|
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,
|
|
});
|
|
}
|