fix(config): allow discord action flags in schema

Ensure discord action flags survive config validation.

🤖 Generated with [Claude Code](https://claude.com/claude-code)

Co-Authored-By: Claude <noreply@anthropic.com>
This commit is contained in:
Jamie Openshaw
2026-01-13 22:11:31 +00:00
committed by Peter Steinberger
parent ff645524d8
commit 72f28be648
6 changed files with 60 additions and 18 deletions

View File

@@ -0,0 +1,24 @@
import { describe, expect, it } from "vitest";
import type { ClawdbotConfig } from "../../../config/config.js";
import { discordMessageActions } from "./discord.js";
describe("discord message actions", () => {
it("lists channel and upload actions by default", () => {
const cfg = { channels: { discord: { token: "d0" } } } as ClawdbotConfig;
const actions = discordMessageActions.listActions?.({ cfg }) ?? [];
expect(actions).toContain("emoji-upload");
expect(actions).toContain("sticker-upload");
expect(actions).toContain("channel-create");
});
it("respects disabled channel actions", () => {
const cfg = {
channels: { discord: { token: "d0", actions: { channels: false } } },
} as ClawdbotConfig;
const actions = discordMessageActions.listActions?.({ cfg }) ?? [];
expect(actions).not.toContain("channel-create");
});
});

View File

@@ -47,7 +47,7 @@ export const discordMessageActions: ChannelMessageActionAdapter = {
actions.add("channel-info");
actions.add("channel-list");
}
if (gate("channels", false)) {
if (gate("channels")) {
actions.add("channel-create");
actions.add("channel-edit");
actions.add("channel-delete");