diff options
| author | GitHub Action <[email protected]> | 2026-01-21 04:07:26 +0000 |
|---|---|---|
| committer | GitHub Action <[email protected]> | 2026-01-21 04:07:26 +0000 |
| commit | 217e4850db500ba8caa10b0fa41b4db6eaf3552b (patch) | |
| tree | dea3d8da7f79be404b5e5198e7fc0036661d20f9 /packages/function/src | |
| parent | be9a0bfee7b5e3a3f553a2d29b7b983cc5bccf5e (diff) | |
| download | opencode-217e4850db500ba8caa10b0fa41b4db6eaf3552b.tar.gz opencode-217e4850db500ba8caa10b0fa41b4db6eaf3552b.zip | |
chore: generate
Diffstat (limited to 'packages/function/src')
| -rw-r--r-- | packages/function/src/api.ts | 28 |
1 files changed, 15 insertions, 13 deletions
diff --git a/packages/function/src/api.ts b/packages/function/src/api.ts index d08e9e49a..54b93ad71 100644 --- a/packages/function/src/api.ts +++ b/packages/function/src/api.ts @@ -216,26 +216,28 @@ export default new Hono<{ Bindings: Env }>() }) .post("/feishu", async (c) => { const body = (await c.req.json()) as { - challenge?: string - event?: { - message?: { - message_id?: string - root_id?: string - parent_id?: string - chat_id?: string - content?: string + challenge?: string + event?: { + message?: { + message_id?: string + root_id?: string + parent_id?: string + chat_id?: string + content?: string + } + } } - } -} console.log(JSON.stringify(body, null, 2)) const challenge = body.challenge if (challenge) return c.json({ challenge }) const content = body.event?.message?.content const parsed = - typeof content === "string" && content.trim().startsWith("{") ? (JSON.parse(content) as { - text?: string -}) : undefined + typeof content === "string" && content.trim().startsWith("{") + ? (JSON.parse(content) as { + text?: string + }) + : undefined const text = typeof parsed?.text === "string" ? parsed.text : typeof content === "string" ? content : "" let message = text.trim().replace(/^@_user_\d+\s*/, "") |
