mirror of
https://github.com/openclaw/openclaw.git
synced 2026-05-11 14:31:42 +00:00
refactor(plugin-sdk): share boolean action param parsing
This commit is contained in:
@@ -10,29 +10,12 @@ import type {
|
||||
import type { OpenClawConfig } from "../../config/config.js";
|
||||
import { createRootScopedReadFile } from "../../infra/fs-safe.js";
|
||||
import { extensionForMime } from "../../media/mime.js";
|
||||
import { readBooleanParam as readBooleanParamShared } from "../../plugin-sdk/boolean-param.js";
|
||||
import { parseSlackTarget } from "../../slack/targets.js";
|
||||
import { parseTelegramTarget } from "../../telegram/targets.js";
|
||||
import { loadWebMedia } from "../../web/media.js";
|
||||
|
||||
export function readBooleanParam(
|
||||
params: Record<string, unknown>,
|
||||
key: string,
|
||||
): boolean | undefined {
|
||||
const raw = params[key];
|
||||
if (typeof raw === "boolean") {
|
||||
return raw;
|
||||
}
|
||||
if (typeof raw === "string") {
|
||||
const trimmed = raw.trim().toLowerCase();
|
||||
if (trimmed === "true") {
|
||||
return true;
|
||||
}
|
||||
if (trimmed === "false") {
|
||||
return false;
|
||||
}
|
||||
}
|
||||
return undefined;
|
||||
}
|
||||
export const readBooleanParam = readBooleanParamShared;
|
||||
|
||||
export function resolveSlackAutoThreadId(params: {
|
||||
to: string;
|
||||
|
||||
Reference in New Issue
Block a user