mirror of
https://github.com/openclaw/openclaw.git
synced 2026-05-06 06:20:43 +00:00
fix(ci): unblock discord boundary typing
This commit is contained in:
@@ -69,5 +69,11 @@ export function releaseDiscordInboundReplay(params: {
|
||||
function normalizeDiscordInboundReplayKeys(
|
||||
replayKeys?: readonly (string | null | undefined)[],
|
||||
): string[] {
|
||||
return [...new Set((replayKeys ?? []).map((replayKey) => replayKey?.trim()).filter(Boolean))];
|
||||
return [
|
||||
...new Set(
|
||||
(replayKeys ?? [])
|
||||
.map((replayKey) => replayKey?.trim())
|
||||
.filter((replayKey): replayKey is string => Boolean(replayKey)),
|
||||
),
|
||||
];
|
||||
}
|
||||
|
||||
@@ -47,6 +47,10 @@ export type DiscordMessageHandlerWithLifecycle = DiscordMessageHandler & {
|
||||
deactivate: () => void;
|
||||
};
|
||||
|
||||
function isNonEmptyString(value: string | undefined): value is string {
|
||||
return typeof value === "string" && value.length > 0;
|
||||
}
|
||||
|
||||
export function createDiscordMessageHandler(
|
||||
params: DiscordMessageHandlerParams,
|
||||
): DiscordMessageHandlerWithLifecycle {
|
||||
@@ -114,7 +118,7 @@ export function createDiscordMessageHandler(
|
||||
if (!last) {
|
||||
return;
|
||||
}
|
||||
const replayKeys = entries.map((entry) => entry.replayKey).filter(Boolean);
|
||||
const replayKeys = entries.map((entry) => entry.replayKey).filter(isNonEmptyString);
|
||||
const abortSignal = last.abortSignal;
|
||||
if (abortSignal?.aborted) {
|
||||
releaseDiscordInboundReplay({
|
||||
@@ -177,7 +181,7 @@ export function createDiscordMessageHandler(
|
||||
}
|
||||
applyImplicitReplyBatchGate(ctx, params.replyToMode, true);
|
||||
if (entries.length > 1) {
|
||||
const ids = entries.map((entry) => entry.data.message?.id).filter(Boolean) as string[];
|
||||
const ids = entries.map((entry) => entry.data.message?.id).filter(isNonEmptyString);
|
||||
if (ids.length > 0) {
|
||||
const ctxBatch = ctx as typeof ctx & {
|
||||
MessageSids?: string[];
|
||||
|
||||
@@ -80,6 +80,7 @@ describe("production lint suppressions", () => {
|
||||
expect(summarizeSuppressions(collectProductionLintSuppressions())).toEqual([
|
||||
"extensions/browser/src/browser/pw-tools-core.interactions.ts|@typescript-eslint/no-implied-eval|2",
|
||||
"scripts/e2e/mcp-channels-harness.ts|unicorn/prefer-add-event-listener|1",
|
||||
"src/agents/agent-scope-config.ts|no-control-regex|1",
|
||||
"src/agents/agent-scope.ts|no-control-regex|1",
|
||||
"src/agents/pi-embedded-runner/run/images.ts|no-control-regex|1",
|
||||
"src/agents/skills-clawhub.ts|no-control-regex|1",
|
||||
|
||||
Reference in New Issue
Block a user