import { manageBotReq } from "./routes/bot"; import { manageMessageReq } from "./routes/message"; import { initSchedule } from "./schedule"; initSchedule() Bun.serve({ async fetch(req) { const url = new URL(req.url); // 根路由 if (url.pathname === "/") return new Response("hello, glade to see you!"); // 机器人 if (url.pathname === '/bot') return await manageBotReq(req); // 消息发送 if (url.pathname === '/message') return await manageMessageReq(req); // 其他 return new Response('OK') }, port: 3000 });