feat: add reusable core store and OpenClaw state-file adapter skeleton / 新增可重用 state store 與 OpenClaw state-file adapter 骨架
This commit is contained in:
16
src/telegram/callback-handler.ts
Normal file
16
src/telegram/callback-handler.ts
Normal file
@@ -0,0 +1,16 @@
|
||||
import { buildReplyEndState } from "../core/state.js"
|
||||
import { normalizeTelegramCallback } from "../core/callback-contract.js"
|
||||
import type { ReplyEndState } from "../types.js"
|
||||
|
||||
export function handleTelegramReplyEndCallback(params: {
|
||||
callbackData: string
|
||||
conversationId: string
|
||||
sessionKey: string | null
|
||||
sourceMessageId: string
|
||||
sourceCallbackId: string
|
||||
timestamp: string
|
||||
}): ReplyEndState | null {
|
||||
const normalized = normalizeTelegramCallback(params)
|
||||
if (!normalized) return null
|
||||
return buildReplyEndState(normalized)
|
||||
}
|
||||
12
src/telegram/reply-decorator.ts
Normal file
12
src/telegram/reply-decorator.ts
Normal file
@@ -0,0 +1,12 @@
|
||||
import type { TelegramInlineKeyboardMarkup } from "../types.js"
|
||||
|
||||
export function buildReplyEndKeyboard(): TelegramInlineKeyboardMarkup {
|
||||
return {
|
||||
inline_keyboard: [
|
||||
[
|
||||
{ text: "A. 繼續", callback_data: "rec:continue" },
|
||||
{ text: "B. 就這樣吧,不需要額外處理", callback_data: "rec:stop" },
|
||||
],
|
||||
],
|
||||
}
|
||||
}
|
||||
Reference in New Issue
Block a user