mirror of
https://github.com/openclaw/openclaw.git
synced 2026-05-06 05:50:43 +00:00
refactor: trim discord access-group wrappers
This commit is contained in:
@@ -1,6 +1,4 @@
|
||||
import {
|
||||
ACCESS_GROUP_ALLOW_FROM_PREFIX,
|
||||
parseAccessGroupAllowFromEntry,
|
||||
resolveAccessGroupAllowFromMatches,
|
||||
type AccessGroupMembershipResolver,
|
||||
} from "openclaw/plugin-sdk/command-auth";
|
||||
@@ -9,12 +7,6 @@ import { logVerbose } from "openclaw/plugin-sdk/runtime-env";
|
||||
import type { RequestClient } from "../internal/discord.js";
|
||||
import { canViewDiscordGuildChannel } from "../send.permissions.js";
|
||||
|
||||
export const DISCORD_ACCESS_GROUP_PREFIX = ACCESS_GROUP_ALLOW_FROM_PREFIX;
|
||||
|
||||
export function parseDiscordAccessGroupEntry(entry: string): string | null {
|
||||
return parseAccessGroupAllowFromEntry(entry);
|
||||
}
|
||||
|
||||
export function createDiscordAccessGroupMembershipResolver(params: {
|
||||
token?: string;
|
||||
rest?: RequestClient;
|
||||
|
||||
@@ -64,12 +64,14 @@ export function createDiscordMessage(params: {
|
||||
mentionedUsers?: Array<{ id: string }>;
|
||||
mentionedEveryone?: boolean;
|
||||
attachments?: Array<Record<string, unknown>>;
|
||||
webhookId?: string;
|
||||
}): import("../internal/discord.js").Message {
|
||||
return {
|
||||
id: params.id,
|
||||
content: params.content,
|
||||
timestamp: new Date().toISOString(),
|
||||
channelId: params.channelId,
|
||||
webhookId: params.webhookId,
|
||||
attachments: params.attachments ?? [],
|
||||
mentionedUsers: params.mentionedUsers ?? [],
|
||||
mentionedRoles: [],
|
||||
|
||||
@@ -696,7 +696,7 @@ describe("preflightDiscordMessage", () => {
|
||||
id: "m-webhook-proxy-1",
|
||||
channelId: threadId,
|
||||
content: "proxied user message",
|
||||
webhook_id: "pluralkit-webhook-1",
|
||||
webhookId: "pluralkit-webhook-1",
|
||||
author: {
|
||||
id: "relay-bot-1",
|
||||
bot: true,
|
||||
|
||||
Reference in New Issue
Block a user