mirror of
https://github.com/ReCloudStudio/WebHooker.git
synced 2026-09-22 16:11:29 +00:00
initial commit
This commit is contained in:
commit
512d4b01d5
55 changed files with 6430 additions and 0 deletions
23
src/index.ts
Normal file
23
src/index.ts
Normal file
|
|
@ -0,0 +1,23 @@
|
|||
import { createServer } from "./server";
|
||||
import { initGateway } from "./discord";
|
||||
import { DiscordGateway } from "./discord-gateway";
|
||||
import type { Env } from "./types";
|
||||
import { log } from "./log";
|
||||
|
||||
export { DiscordGateway };
|
||||
|
||||
const app = createServer();
|
||||
|
||||
export default {
|
||||
async fetch(request: Request, env: Env): Promise<Response> {
|
||||
return app.fetch(request, env);
|
||||
},
|
||||
|
||||
async scheduled(_event: ScheduledEvent, env: Env): Promise<void> {
|
||||
try {
|
||||
await initGateway(env);
|
||||
} catch (err) {
|
||||
log.error({ err }, "Gateway init from cron failed");
|
||||
}
|
||||
},
|
||||
};
|
||||
Loading…
Add table
Add a link
Reference in a new issue