chore: generate
This commit is contained in:
@@ -216,26 +216,28 @@ export default new Hono<{ Bindings: Env }>()
|
|||||||
})
|
})
|
||||||
.post("/feishu", async (c) => {
|
.post("/feishu", async (c) => {
|
||||||
const body = (await c.req.json()) as {
|
const body = (await c.req.json()) as {
|
||||||
challenge?: string
|
challenge?: string
|
||||||
event?: {
|
event?: {
|
||||||
message?: {
|
message?: {
|
||||||
message_id?: string
|
message_id?: string
|
||||||
root_id?: string
|
root_id?: string
|
||||||
parent_id?: string
|
parent_id?: string
|
||||||
chat_id?: string
|
chat_id?: string
|
||||||
content?: string
|
content?: string
|
||||||
|
}
|
||||||
|
}
|
||||||
}
|
}
|
||||||
}
|
|
||||||
}
|
|
||||||
console.log(JSON.stringify(body, null, 2))
|
console.log(JSON.stringify(body, null, 2))
|
||||||
const challenge = body.challenge
|
const challenge = body.challenge
|
||||||
if (challenge) return c.json({ challenge })
|
if (challenge) return c.json({ challenge })
|
||||||
|
|
||||||
const content = body.event?.message?.content
|
const content = body.event?.message?.content
|
||||||
const parsed =
|
const parsed =
|
||||||
typeof content === "string" && content.trim().startsWith("{") ? (JSON.parse(content) as {
|
typeof content === "string" && content.trim().startsWith("{")
|
||||||
text?: string
|
? (JSON.parse(content) as {
|
||||||
}) : undefined
|
text?: string
|
||||||
|
})
|
||||||
|
: undefined
|
||||||
const text = typeof parsed?.text === "string" ? parsed.text : typeof content === "string" ? content : ""
|
const text = typeof parsed?.text === "string" ? parsed.text : typeof content === "string" ? content : ""
|
||||||
|
|
||||||
let message = text.trim().replace(/^@_user_\d+\s*/, "")
|
let message = text.trim().replace(/^@_user_\d+\s*/, "")
|
||||||
|
|||||||
Reference in New Issue
Block a user