refactor: trim discord monitor helper exports · openclaw/openclaw@b7fd104
steipete
·
2026-05-01
·
via Recent Commits to openclaw:main
| Original file line number | Diff line number | Diff line change |
|---|
@@ -19,7 +19,7 @@ export type DiscordAllowList = {
|
19 | 19 | names: Set<string>; |
20 | 20 | }; |
21 | 21 | |
22 | | -export type DiscordAllowListMatch = AllowlistMatch<"wildcard" | "id" | "name" | "tag">; |
| 22 | +type DiscordAllowListMatch = AllowlistMatch<"wildcard" | "id" | "name" | "tag">; |
23 | 23 | |
24 | 24 | const DISCORD_OWNER_ALLOWLIST_PREFIXES = ["discord:", "user:", "pk:"]; |
25 | 25 | |
@@ -149,7 +149,7 @@ export function resolveDiscordAllowListMatch(params: {
|
149 | 149 | return { allowed: false }; |
150 | 150 | } |
151 | 151 | |
152 | | -export function resolveDiscordUserAllowed(params: { |
| 152 | +function resolveDiscordUserAllowed(params: { |
153 | 153 | allowList?: string[]; |
154 | 154 | userId: string; |
155 | 155 | userName?: string; |
@@ -500,7 +500,7 @@ export function resolveDiscordShouldRequireMention(params: {
|
500 | 500 | return params.channelConfig?.requireMention ?? params.guildInfo?.requireMention ?? true; |
501 | 501 | } |
502 | 502 | |
503 | | -export function isDiscordAutoThreadOwnedByBot(params: { |
| 503 | +function isDiscordAutoThreadOwnedByBot(params: { |
504 | 504 | isThread: boolean; |
505 | 505 | channelConfig?: DiscordChannelConfigResolved | null; |
506 | 506 | botId?: string | null; |
|
| Original file line number | Diff line number | Diff line change |
|---|
@@ -21,7 +21,7 @@ const DEFAULT_MIN_UPDATE_INTERVAL_MS = 15_000;
|
21 | 21 | const MIN_INTERVAL_MS = 5_000; |
22 | 22 | const MIN_UPDATE_INTERVAL_MS = 1_000; |
23 | 23 | |
24 | | -export type DiscordAutoPresenceState = "healthy" | "degraded" | "exhausted"; |
| 24 | +type DiscordAutoPresenceState = "healthy" | "degraded" | "exhausted"; |
25 | 25 | |
26 | 26 | type ResolvedDiscordAutoPresenceConfig = { |
27 | 27 | enabled: boolean; |
@@ -32,7 +32,7 @@ type ResolvedDiscordAutoPresenceConfig = {
|
32 | 32 | exhaustedText?: string; |
33 | 33 | }; |
34 | 34 | |
35 | | -export type DiscordAutoPresenceDecision = { |
| 35 | +type DiscordAutoPresenceDecision = { |
36 | 36 | state: DiscordAutoPresenceState; |
37 | 37 | unavailableReason?: AuthProfileFailureReason | null; |
38 | 38 | presence: UpdatePresenceData; |
@@ -256,7 +256,7 @@ function stablePresenceSignature(payload: UpdatePresenceData): string {
|
256 | 256 | }); |
257 | 257 | } |
258 | 258 | |
259 | | -export type DiscordAutoPresenceController = { |
| 259 | +type DiscordAutoPresenceController = { |
260 | 260 | start: () => void; |
261 | 261 | stop: () => void; |
262 | 262 | refresh: () => void; |
|
| Original file line number | Diff line number | Diff line change |
|---|
@@ -28,7 +28,7 @@ function resolveDiscordChannelNumberPropertySafe(
|
28 | 28 | return typeof value === "number" ? value : undefined; |
29 | 29 | } |
30 | 30 | |
31 | | -export type DiscordChannelInfoSafe = { |
| 31 | +type DiscordChannelInfoSafe = { |
32 | 32 | name?: string; |
33 | 33 | topic?: string; |
34 | 34 | type?: number; |
|
| Original file line number | Diff line number | Diff line change |
|---|
@@ -51,7 +51,7 @@ export function parseExecApprovalData(
|
51 | 51 | }; |
52 | 52 | } |
53 | 53 | |
54 | | -export type ExecApprovalButtonContext = { |
| 54 | +type ExecApprovalButtonContext = { |
55 | 55 | getApprovers: () => string[]; |
56 | 56 | resolveApproval: ( |
57 | 57 | approvalId: string, |
|
| Original file line number | Diff line number | Diff line change |
|---|
@@ -10,7 +10,7 @@ export type DiscordGatewayHandle = Pick<GatewayPlugin, "disconnect"> & {
|
10 | 10 | |
11 | 11 | type GatewaySocketListener = (...args: unknown[]) => void; |
12 | 12 | |
13 | | -export type DiscordGatewaySocket = { |
| 13 | +type DiscordGatewaySocket = { |
14 | 14 | on: (event: "close" | "error", listener: GatewaySocketListener) => unknown; |
15 | 15 | listeners: (event: "close" | "error") => GatewaySocketListener[]; |
16 | 16 | removeListener: (event: "close" | "error", listener: GatewaySocketListener) => unknown; |
|
| Original file line number | Diff line number | Diff line change |
|---|
@@ -16,7 +16,7 @@ const MAX_DISCORD_GATEWAY_INFO_TIMEOUT_MS = 120_000;
|
16 | 16 | const DISCORD_GATEWAY_INFO_TIMEOUT_ENV = "OPENCLAW_DISCORD_GATEWAY_INFO_TIMEOUT_MS"; |
17 | 17 | const DISCORD_GATEWAY_METADATA_FALLBACK_LOG_INTERVAL_MS = 60_000; |
18 | 18 | |
19 | | -export type DiscordGatewayMetadataResponse = Pick<Response, "ok" | "status" | "text">; |
| 19 | +type DiscordGatewayMetadataResponse = Pick<Response, "ok" | "status" | "text">; |
20 | 20 | export type DiscordGatewayFetchInit = Record<string, unknown> & { |
21 | 21 | headers?: Record<string, string>; |
22 | 22 | }; |
|
| Original file line number | Diff line number | Diff line change |
|---|
@@ -3,11 +3,7 @@ import { danger } from "openclaw/plugin-sdk/runtime-env";
|
3 | 3 | import type { RuntimeEnv } from "openclaw/plugin-sdk/runtime-env"; |
4 | 4 | import { formatErrorMessage } from "openclaw/plugin-sdk/ssrf-runtime"; |
5 | 5 | |
6 | | -export type DiscordGatewayEventType = |
7 | | -| "disallowed-intents" |
8 | | -| "fatal" |
9 | | -| "other" |
10 | | -| "reconnect-exhausted"; |
| 6 | +type DiscordGatewayEventType = "disallowed-intents" | "fatal" | "other" | "reconnect-exhausted"; |
11 | 7 | |
12 | 8 | export type DiscordGatewayEvent = { |
13 | 9 | type: DiscordGatewayEventType; |
|
| Original file line number | Diff line number | Diff line change |
|---|
@@ -9,7 +9,7 @@ import {
|
9 | 9 | type DiscordGuildEntryResolved, |
10 | 10 | } from "./allow-list.js"; |
11 | 11 | |
12 | | -export type DiscordSupplementalContextSender = { |
| 12 | +type DiscordSupplementalContextSender = { |
13 | 13 | id?: string; |
14 | 14 | name?: string; |
15 | 15 | tag?: string; |
|
| Original file line number | Diff line number | Diff line change |
|---|
@@ -14,15 +14,9 @@ type DiscordInboundJobRuntimeField =
|
14 | 14 | | "threadBindings" |
15 | 15 | | "discordRestFetch"; |
16 | 16 | |
17 | | -export type DiscordInboundJobRuntime = Pick< |
18 | | -DiscordMessagePreflightContext, |
19 | | -DiscordInboundJobRuntimeField |
20 | | ->; |
| 17 | +type DiscordInboundJobRuntime = Pick<DiscordMessagePreflightContext, DiscordInboundJobRuntimeField>; |
21 | 18 | |
22 | | -export type DiscordInboundJobPayload = Omit< |
23 | | -DiscordMessagePreflightContext, |
24 | | -DiscordInboundJobRuntimeField |
25 | | ->; |
| 19 | +type DiscordInboundJobPayload = Omit<DiscordMessagePreflightContext, DiscordInboundJobRuntimeField>; |
26 | 20 | |
27 | 21 | export type DiscordInboundJob = { |
28 | 22 | queueKey: string; |
|
| Original file line number | Diff line number | Diff line change |
|---|
@@ -25,7 +25,7 @@ export function isBoundThreadBotSystemMessage(params: {
|
25 | 25 | return DISCORD_BOUND_THREAD_SYSTEM_PREFIXES.some((prefix) => text.startsWith(prefix)); |
26 | 26 | } |
27 | 27 | |
28 | | -export type BoundThreadLookupRecordLike = { |
| 28 | +type BoundThreadLookupRecordLike = { |
29 | 29 | webhookId?: string | null; |
30 | 30 | metadata?: { |
31 | 31 | webhookId?: string | null; |
|
此内容由惯性聚合(RSS阅读器)自动聚合整理,仅供阅读参考。 原文来自 — 版权归原作者所有。