refactor: unify channel open-group-policy warning builders

This commit is contained in:
Peter Steinberger
2026-03-07 22:06:29 +00:00
parent 4b61779a46
commit 8e0e76697a
19 changed files with 293 additions and 22 deletions

View File

@@ -1,3 +1,7 @@
import {
buildOpenGroupPolicyConfigureRouteAllowlistWarning,
buildOpenGroupPolicyWarning,
} from "openclaw/plugin-sdk";
import {
applyAccountNameToChannelSection,
buildComputedAccountStatusSnapshot,
@@ -151,11 +155,22 @@ export const discordPlugin: ChannelPlugin<ResolvedDiscordAccount> = {
if (groupPolicy === "open") {
if (channelAllowlistConfigured) {
warnings.push(
`- Discord guilds: groupPolicy="open" allows any channel not explicitly denied to trigger (mention-gated). Set channels.discord.groupPolicy="allowlist" and configure channels.discord.guilds.<id>.channels.`,
buildOpenGroupPolicyConfigureRouteAllowlistWarning({
surface: "Discord guilds",
openScope: "any channel not explicitly denied",
groupPolicyPath: "channels.discord.groupPolicy",
routeAllowlistPath: "channels.discord.guilds.<id>.channels",
}),
);
} else {
warnings.push(
`- Discord guilds: groupPolicy="open" with no guild/channel allowlist; any channel can trigger (mention-gated). Set channels.discord.groupPolicy="allowlist" and configure channels.discord.guilds.<id>.channels.`,
buildOpenGroupPolicyWarning({
surface: "Discord guilds",
openBehavior:
"with no guild/channel allowlist; any channel can trigger (mention-gated)",
remediation:
'Set channels.discord.groupPolicy="allowlist" and configure channels.discord.guilds.<id>.channels',
}),
);
}
}