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:
committed by
Peter Steinberger
parent
ff645524d8
commit
72f28be648
24
src/channels/plugins/actions/discord.test.ts
Normal file
24
src/channels/plugins/actions/discord.test.ts
Normal 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");
|
||||
});
|
||||
});
|
||||
@@ -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");
|
||||
|
||||
Reference in New Issue
Block a user