mirror of
https://github.com/openclaw/openclaw.git
synced 2026-03-26 01:11:37 +00:00
24 lines
844 B
TypeScript
24 lines
844 B
TypeScript
import type { OpenClawConfig } from "openclaw/plugin-sdk/config-runtime";
|
|
import { getExecApprovalReplyMetadata } from "openclaw/plugin-sdk/infra-runtime";
|
|
import type { ReplyPayload } from "openclaw/plugin-sdk/reply-runtime";
|
|
import { resolveDiscordAccount } from "./accounts.js";
|
|
|
|
export function isDiscordExecApprovalClientEnabled(params: {
|
|
cfg: OpenClawConfig;
|
|
accountId?: string | null;
|
|
}): boolean {
|
|
const config = resolveDiscordAccount(params).config.execApprovals;
|
|
return Boolean(config?.enabled && (config.approvers?.length ?? 0) > 0);
|
|
}
|
|
|
|
export function shouldSuppressLocalDiscordExecApprovalPrompt(params: {
|
|
cfg: OpenClawConfig;
|
|
accountId?: string | null;
|
|
payload: ReplyPayload;
|
|
}): boolean {
|
|
return (
|
|
isDiscordExecApprovalClientEnabled(params) &&
|
|
getExecApprovalReplyMetadata(params.payload) !== null
|
|
);
|
|
}
|