feat: improve consumer-facing flow and payload helper / 改善可直接使用流程與 Telegram payload helper

This commit is contained in:
Alice (OpenClaw)
2026-05-14 08:48:17 +08:00
parent 9ce2b09f71
commit bd6d19d95b
2 changed files with 25 additions and 0 deletions

View File

@@ -0,0 +1,14 @@
import { buildDefaultReplyEndButtons } from "../runtime/openclaw-telegram-poc.js"
import type { TelegramInlineButton } from "../types.js"
export type TelegramReplyEndPayload = {
text: string
buttons: TelegramInlineButton[][]
}
export function buildTelegramReplyEndPayload(text: string): TelegramReplyEndPayload {
return {
text,
buttons: buildDefaultReplyEndButtons(),
}
}

View File

@@ -0,0 +1,11 @@
import test from "node:test"
import assert from "node:assert/strict"
import { buildTelegramReplyEndPayload } from "../src/telegram/outbound-payload.ts"
test("buildTelegramReplyEndPayload returns text plus default reply-end buttons", () => {
const payload = buildTelegramReplyEndPayload("hello")
assert.equal(payload.text, "hello")
assert.equal(payload.buttons[0][0].callback_data, "rec:continue")
assert.equal(payload.buttons[0][1].callback_data, "rec:stop")
})