feat: add OpenClaw plugin skeleton / 新增 OpenClaw plugin skeleton
This commit is contained in:
33
src/adapters/openclaw-plugin-skeleton.ts
Normal file
33
src/adapters/openclaw-plugin-skeleton.ts
Normal file
@@ -0,0 +1,33 @@
|
||||
import { buildOpenClawTelegramMessageToolPayload } from "./openclaw-message-tool.js"
|
||||
import { handleOpenClawTelegramReplyEndInteraction } from "./openclaw-interactive-handler.ts"
|
||||
|
||||
export type OpenClawInteractiveRegistration = {
|
||||
namespace: string
|
||||
handler: (ctx: {
|
||||
callback: {
|
||||
data: string
|
||||
messageId: string
|
||||
chatId: string
|
||||
}
|
||||
conversationId: string
|
||||
sessionKey: string | null
|
||||
callbackId: string
|
||||
respond: {
|
||||
editButtons: (input: { buttons: { text: string; callback_data: string }[][] }) => Promise<void> | void
|
||||
reply: (input: { text: string }) => Promise<void> | void
|
||||
}
|
||||
}) => Promise<boolean>
|
||||
}
|
||||
|
||||
export function buildOpenClawReplyEndPresentation(target: string, text: string) {
|
||||
return buildOpenClawTelegramMessageToolPayload(target, text)
|
||||
}
|
||||
|
||||
export function createOpenClawReplyEndInteractiveRegistration(baseDir: string): OpenClawInteractiveRegistration {
|
||||
return {
|
||||
namespace: "rec",
|
||||
handler: async (ctx) => {
|
||||
return await handleOpenClawTelegramReplyEndInteraction(baseDir, ctx)
|
||||
},
|
||||
}
|
||||
}
|
||||
Reference in New Issue
Block a user