mirror of
https://github.com/openclaw/openclaw.git
synced 2026-05-08 21:28:26 +00:00
refactor: rename to openclaw
This commit is contained in:
@@ -130,14 +130,14 @@ describe("DiscordMessageListener", () => {
|
||||
|
||||
describe("discord allowlist helpers", () => {
|
||||
it("normalizes slugs", () => {
|
||||
expect(normalizeDiscordSlug("Friends of Clawd")).toBe("friends-of-clawd");
|
||||
expect(normalizeDiscordSlug("Friends of OpenClaw")).toBe("friends-of-openclaw");
|
||||
expect(normalizeDiscordSlug("#General")).toBe("general");
|
||||
expect(normalizeDiscordSlug("Dev__Chat")).toBe("dev-chat");
|
||||
});
|
||||
|
||||
it("matches ids or names", () => {
|
||||
const allow = normalizeDiscordAllowList(
|
||||
["123", "steipete", "Friends of Clawd"],
|
||||
["123", "steipete", "Friends of OpenClaw"],
|
||||
["discord:", "user:", "guild:", "channel:"],
|
||||
);
|
||||
expect(allow).not.toBeNull();
|
||||
@@ -146,7 +146,7 @@ describe("discord allowlist helpers", () => {
|
||||
}
|
||||
expect(allowListMatches(allow, { id: "123" })).toBe(true);
|
||||
expect(allowListMatches(allow, { name: "steipete" })).toBe(true);
|
||||
expect(allowListMatches(allow, { name: "friends-of-clawd" })).toBe(true);
|
||||
expect(allowListMatches(allow, { name: "friends-of-openclaw" })).toBe(true);
|
||||
expect(allowListMatches(allow, { name: "other" })).toBe(false);
|
||||
});
|
||||
});
|
||||
@@ -154,26 +154,26 @@ describe("discord allowlist helpers", () => {
|
||||
describe("discord guild/channel resolution", () => {
|
||||
it("resolves guild entry by id", () => {
|
||||
const guildEntries = makeEntries({
|
||||
"123": { slug: "friends-of-clawd" },
|
||||
"123": { slug: "friends-of-openclaw" },
|
||||
});
|
||||
const resolved = resolveDiscordGuildEntry({
|
||||
guild: fakeGuild("123", "Friends of Clawd"),
|
||||
guild: fakeGuild("123", "Friends of OpenClaw"),
|
||||
guildEntries,
|
||||
});
|
||||
expect(resolved?.id).toBe("123");
|
||||
expect(resolved?.slug).toBe("friends-of-clawd");
|
||||
expect(resolved?.slug).toBe("friends-of-openclaw");
|
||||
});
|
||||
|
||||
it("resolves guild entry by slug key", () => {
|
||||
const guildEntries = makeEntries({
|
||||
"friends-of-clawd": { slug: "friends-of-clawd" },
|
||||
"friends-of-openclaw": { slug: "friends-of-openclaw" },
|
||||
});
|
||||
const resolved = resolveDiscordGuildEntry({
|
||||
guild: fakeGuild("123", "Friends of Clawd"),
|
||||
guild: fakeGuild("123", "Friends of OpenClaw"),
|
||||
guildEntries,
|
||||
});
|
||||
expect(resolved?.id).toBe("123");
|
||||
expect(resolved?.slug).toBe("friends-of-clawd");
|
||||
expect(resolved?.slug).toBe("friends-of-openclaw");
|
||||
});
|
||||
|
||||
it("falls back to wildcard guild entry", () => {
|
||||
@@ -181,7 +181,7 @@ describe("discord guild/channel resolution", () => {
|
||||
"*": { requireMention: false },
|
||||
});
|
||||
const resolved = resolveDiscordGuildEntry({
|
||||
guild: fakeGuild("123", "Friends of Clawd"),
|
||||
guild: fakeGuild("123", "Friends of OpenClaw"),
|
||||
guildEntries,
|
||||
});
|
||||
expect(resolved?.id).toBe("123");
|
||||
@@ -547,15 +547,15 @@ describe("discord group DM gating", () => {
|
||||
it("matches group DM allowlist", () => {
|
||||
expect(
|
||||
resolveGroupDmAllow({
|
||||
channels: ["clawd-dm"],
|
||||
channels: ["openclaw-dm"],
|
||||
channelId: "1",
|
||||
channelName: "Clawd DM",
|
||||
channelSlug: "clawd-dm",
|
||||
channelName: "OpenClaw DM",
|
||||
channelSlug: "openclaw-dm",
|
||||
}),
|
||||
).toBe(true);
|
||||
expect(
|
||||
resolveGroupDmAllow({
|
||||
channels: ["clawd-dm"],
|
||||
channels: ["openclaw-dm"],
|
||||
channelId: "1",
|
||||
channelName: "Other",
|
||||
channelSlug: "other",
|
||||
|
||||
Reference in New Issue
Block a user