egg_server/routes/bot/index.ts
zhaoyingbo cabc23ae77
Some checks are pending
Egg CI/CD / build-image (push) Waiting to run
Egg CI/CD / deploy (push) Blocked by required conditions
feat: 支持根据用户组转发消息
2024-03-04 12:01:14 +00:00

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!")
}