13 lines
461 B
TypeScript
13 lines
461 B
TypeScript
import { manageEventMsg } from "./eventMsg"
|
|
|
|
export const manageBotReq = async (req: Request) => {
|
|
const body = await req.json() as any
|
|
// 验证机器人
|
|
if (body?.type === 'url_verification') {
|
|
console.log("🚀 ~ manageBotReq ~ url_verification:")
|
|
return Response.json({ challenge: body?.challenge })
|
|
}
|
|
// 处理Event消息
|
|
if (await manageEventMsg(body)) return new Response("success")
|
|
return new Response("hello, glade to see you!")
|
|
} |