mirror of
https://github.com/openclaw/openclaw.git
synced 2026-05-09 21:14:31 +00:00
Infra: skip Discord text exec approvals
This commit is contained in:
@@ -98,13 +98,10 @@ function buildTargetKey(target: ExecApprovalForwardTarget): string {
|
||||
return [channel, target.to, accountId, threadId].join(":");
|
||||
}
|
||||
|
||||
function shouldSkipDiscordForwarding(cfg: OpenClawConfig): boolean {
|
||||
const discordConfig = cfg.channels?.discord?.execApprovals;
|
||||
if (!discordConfig?.enabled) {
|
||||
return false;
|
||||
}
|
||||
const target = discordConfig.target ?? "dm";
|
||||
return target === "channel" || target === "both";
|
||||
// Discord has component-based exec approvals; skip the text fallback there.
|
||||
function shouldSkipDiscordForwarding(target: ExecApprovalForwardTarget): boolean {
|
||||
const channel = normalizeMessageChannel(target.channel) ?? target.channel;
|
||||
return channel === "discord";
|
||||
}
|
||||
|
||||
function formatApprovalCommand(command: string): { inline: boolean; text: string } {
|
||||
@@ -274,9 +271,7 @@ export function createExecApprovalForwarder(
|
||||
}
|
||||
}
|
||||
|
||||
const filteredTargets = shouldSkipDiscordForwarding(cfg)
|
||||
? targets.filter((target) => normalizeMessageChannel(target.channel) !== "discord")
|
||||
: targets;
|
||||
const filteredTargets = targets.filter((target) => !shouldSkipDiscordForwarding(target));
|
||||
|
||||
if (filteredTargets.length === 0) {
|
||||
return;
|
||||
|
||||
Reference in New Issue
Block a user