Skip to content

Commit 217e485

Browse files
committed
chore: generate
1 parent be9a0bf commit 217e485

1 file changed

Lines changed: 15 additions & 13 deletions

File tree

packages/function/src/api.ts

Lines changed: 15 additions & 13 deletions
Original file line numberDiff line numberDiff line change
@@ -216,26 +216,28 @@ export default new Hono<{ Bindings: Env }>()
216216
})
217217
.post("/feishu", async (c) => {
218218
const body = (await c.req.json()) as {
219-
challenge?: string
220-
event?: {
221-
message?: {
222-
message_id?: string
223-
root_id?: string
224-
parent_id?: string
225-
chat_id?: string
226-
content?: string
219+
challenge?: string
220+
event?: {
221+
message?: {
222+
message_id?: string
223+
root_id?: string
224+
parent_id?: string
225+
chat_id?: string
226+
content?: string
227+
}
228+
}
227229
}
228-
}
229-
}
230230
console.log(JSON.stringify(body, null, 2))
231231
const challenge = body.challenge
232232
if (challenge) return c.json({ challenge })
233233

234234
const content = body.event?.message?.content
235235
const parsed =
236-
typeof content === "string" && content.trim().startsWith("{") ? (JSON.parse(content) as {
237-
text?: string
238-
}) : undefined
236+
typeof content === "string" && content.trim().startsWith("{")
237+
? (JSON.parse(content) as {
238+
text?: string
239+
})
240+
: undefined
239241
const text = typeof parsed?.text === "string" ? parsed.text : typeof content === "string" ? content : ""
240242

241243
let message = text.trim().replace(/^@_user_\d+\s*/, "")

0 commit comments

Comments
 (0)