mirror of
https://github.com/farcasclaudiu/openclaw.git
synced 2026-06-28 19:01:47 +03:00
refactor: unify message tool + CLI
This commit is contained in:
@@ -63,19 +63,7 @@ export const telegramMessageActions: ProviderMessageActionAdapter = {
|
||||
const mediaUrl = readStringParam(params, "media", { trim: false });
|
||||
const replyTo = readStringParam(params, "replyTo");
|
||||
const threadId = readStringParam(params, "threadId");
|
||||
let buttons = params.buttons;
|
||||
if (!buttons) {
|
||||
const buttonsJson = readStringParam(params, "buttonsJson", {
|
||||
trim: false,
|
||||
});
|
||||
if (buttonsJson) {
|
||||
try {
|
||||
buttons = JSON.parse(buttonsJson);
|
||||
} catch {
|
||||
throw new Error("buttons-json must be valid JSON");
|
||||
}
|
||||
}
|
||||
}
|
||||
const buttons = params.buttons;
|
||||
return await handleTelegramAction(
|
||||
{
|
||||
action: "sendMessage",
|
||||
|
||||
@@ -0,0 +1,43 @@
|
||||
export const PROVIDER_MESSAGE_ACTION_NAMES = [
|
||||
"send",
|
||||
"poll",
|
||||
"react",
|
||||
"reactions",
|
||||
"read",
|
||||
"edit",
|
||||
"delete",
|
||||
"pin",
|
||||
"unpin",
|
||||
"list-pins",
|
||||
"permissions",
|
||||
"thread-create",
|
||||
"thread-list",
|
||||
"thread-reply",
|
||||
"search",
|
||||
"sticker",
|
||||
"member-info",
|
||||
"role-info",
|
||||
"emoji-list",
|
||||
"emoji-upload",
|
||||
"sticker-upload",
|
||||
"role-add",
|
||||
"role-remove",
|
||||
"channel-info",
|
||||
"channel-list",
|
||||
"channel-create",
|
||||
"channel-edit",
|
||||
"channel-delete",
|
||||
"channel-move",
|
||||
"category-create",
|
||||
"category-edit",
|
||||
"category-delete",
|
||||
"voice-status",
|
||||
"event-list",
|
||||
"event-create",
|
||||
"timeout",
|
||||
"kick",
|
||||
"ban",
|
||||
] as const;
|
||||
|
||||
export type ProviderMessageActionName =
|
||||
(typeof PROVIDER_MESSAGE_ACTION_NAMES)[number];
|
||||
@@ -13,8 +13,11 @@ import type {
|
||||
GatewayClientName,
|
||||
} from "../../utils/message-provider.js";
|
||||
import type { ChatProviderId } from "../registry.js";
|
||||
import type { ProviderMessageActionName as ProviderMessageActionNameFromList } from "./message-action-names.js";
|
||||
import type { ProviderOnboardingAdapter } from "./onboarding-types.js";
|
||||
|
||||
export { PROVIDER_MESSAGE_ACTION_NAMES } from "./message-action-names.js";
|
||||
|
||||
export type ProviderId = ChatProviderId;
|
||||
|
||||
export type ProviderOutboundTargetMode = "explicit" | "implicit" | "heartbeat";
|
||||
@@ -478,45 +481,7 @@ export type ProviderMessagingAdapter = {
|
||||
normalizeTarget?: (raw: string) => string | undefined;
|
||||
};
|
||||
|
||||
export type ProviderMessageActionName =
|
||||
| "send"
|
||||
| "poll"
|
||||
| "react"
|
||||
| "reactions"
|
||||
| "read"
|
||||
| "edit"
|
||||
| "delete"
|
||||
| "pin"
|
||||
| "unpin"
|
||||
| "list-pins"
|
||||
| "permissions"
|
||||
| "thread-create"
|
||||
| "thread-list"
|
||||
| "thread-reply"
|
||||
| "search"
|
||||
| "sticker"
|
||||
| "member-info"
|
||||
| "role-info"
|
||||
| "emoji-list"
|
||||
| "emoji-upload"
|
||||
| "sticker-upload"
|
||||
| "role-add"
|
||||
| "role-remove"
|
||||
| "channel-info"
|
||||
| "channel-list"
|
||||
| "channel-create"
|
||||
| "channel-edit"
|
||||
| "channel-delete"
|
||||
| "channel-move"
|
||||
| "category-create"
|
||||
| "category-edit"
|
||||
| "category-delete"
|
||||
| "voice-status"
|
||||
| "event-list"
|
||||
| "event-create"
|
||||
| "timeout"
|
||||
| "kick"
|
||||
| "ban";
|
||||
export type ProviderMessageActionName = ProviderMessageActionNameFromList;
|
||||
|
||||
export type ProviderMessageActionContext = {
|
||||
provider: ProviderId;
|
||||
|
||||
Reference in New Issue
Block a user