feat: add OpenClaw message-tool payload adapter / 新增 OpenClaw message-tool payload adapter

This commit is contained in:
Alice (OpenClaw)
2026-05-14 08:56:11 +08:00
parent bd6d19d95b
commit 3981364d9b
2 changed files with 58 additions and 0 deletions

View File

@@ -0,0 +1,42 @@
import { buildTelegramReplyEndPayload } from "../telegram/outbound-payload.js"
export type OpenClawTelegramMessageToolPayload = {
action: "send"
channel: "telegram"
target: string
message: string
presentation: {
blocks: Array<
| { type: "text"; text: string }
| {
type: "buttons"
buttons: Array<{
label: string
value: string
}>
}
>
}
}
export function buildOpenClawTelegramMessageToolPayload(target: string, text: string): OpenClawTelegramMessageToolPayload {
const payload = buildTelegramReplyEndPayload(text)
return {
action: "send",
channel: "telegram",
target,
message: payload.text,
presentation: {
blocks: [
{ type: "text", text: payload.text },
{
type: "buttons",
buttons: payload.buttons[0].map((button) => ({
label: button.text,
value: button.callback_data,
})),
},
],
},
}
}