

























@@ -2,7 +2,8 @@ import { readBooleanParam } from "openclaw/plugin-sdk/boolean-param";
22import {
33createActionGate,
44jsonResult,
5-readNumberParam,
5+readNonNegativeIntegerParam,
6+readPositiveIntegerParam,
67readReactionParams,
78readStringParam,
89} from "openclaw/plugin-sdk/channel-actions";
@@ -103,7 +104,7 @@ async function resolveChatGuid(params: {
103104if (explicitChatGuid) {
104105return explicitChatGuid;
105106}
106-const explicitChatId = readNumberParam(params.actionParams, "chatId", { integer: true });
107+const explicitChatId = readPositiveIntegerParam(params.actionParams, "chatId");
107108if (typeof explicitChatId === "number") {
108109const resolved = await params.runtime.resolveChatGuidForTarget({
109110target: { kind: "chat_id", chatId: explicitChatId },
@@ -198,7 +199,7 @@ function buildChatContextFromActionParams(params: {
198199}): IMessageChatContext {
199200const explicitChatGuid = readStringParam(params.actionParams, "chatGuid")?.trim();
200201const explicitChatIdentifier = readStringParam(params.actionParams, "chatIdentifier")?.trim();
201-const explicitChatId = readNumberParam(params.actionParams, "chatId", { integer: true });
202+const explicitChatId = readPositiveIntegerParam(params.actionParams, "chatId");
202203// Trim before the truthy check so a whitespace-only currentChannelId can't
203204// reach parseIMessageTarget (which throws on empty/whitespace input and
204205// would abort the whole action with a confusing "target is required").
@@ -486,7 +487,7 @@ export const imessageMessageActions: ChannelMessageActionAdapter = {
486487);
487488}
488489const resolvedMessageId = messageId();
489-const partIndex = readNumberParam(params, "partIndex", { integer: true });
490+const partIndex = readNonNegativeIntegerParam(params, "partIndex");
490491const resolvedChatGuid = await chatGuid();
491492const reactionsToSend = remove && !reaction ? [...TAPBACK_KINDS] : reaction ? [reaction] : [];
492493for (const kind of reactionsToSend) {
@@ -512,7 +513,7 @@ export const imessageMessageActions: ChannelMessageActionAdapter = {
512513if (!text) {
513514throw new Error("iMessage edit requires text, newText, or message.");
514515}
515-const partIndex = readNumberParam(params, "partIndex", { integer: true });
516+const partIndex = readNonNegativeIntegerParam(params, "partIndex");
516517const backwardsCompatMessage = readStringParam(params, "backwardsCompatMessage");
517518const resolvedChatGuid = await chatGuid();
518519await runtime.editMessage({
@@ -529,7 +530,7 @@ export const imessageMessageActions: ChannelMessageActionAdapter = {
529530if (action === "unsend") {
530531await assertPrivateApiEnabled();
531532const resolvedMessageId = messageId({ requireFromMe: true });
532-const partIndex = readNumberParam(params, "partIndex", { integer: true });
533+const partIndex = readNonNegativeIntegerParam(params, "partIndex");
533534const resolvedChatGuid = await chatGuid();
534535await runtime.unsendMessage({
535536chatGuid: resolvedChatGuid,
@@ -569,7 +570,7 @@ export const imessageMessageActions: ChannelMessageActionAdapter = {
569570);
570571}
571572}
572-const partIndex = readNumberParam(params, "partIndex", { integer: true });
573+const partIndex = readNonNegativeIntegerParam(params, "partIndex");
573574const resolvedChatGuid = await chatGuid();
574575const result = await runtime.sendRichMessage({
575576chatGuid: resolvedChatGuid,
此内容由惯性聚合(RSS阅读器)自动聚合整理,仅供阅读参考。 原文来自 — 版权归原作者所有。