mirror of
https://github.com/swc-project/swc.git
synced 2024-12-30 00:52:29 +03:00
20 lines
602 B
TypeScript
20 lines
602 B
TypeScript
|
// Loaded from https://deno.land/x/discordeno@11.0.0-rc.2/src/ws/handle_discord_payload.ts
|
||
|
|
||
|
|
||
|
import type { DiscordGatewayPayload } from "../types/gateway/gateway_payload.ts";
|
||
|
import { ws } from "./ws.ts";
|
||
|
|
||
|
/** Handler for processing all dispatch payloads that should be sent/forwarded to another server/vps/process. */
|
||
|
export async function handleDiscordPayload(data: DiscordGatewayPayload, shardId: number) {
|
||
|
await fetch(ws.url, {
|
||
|
headers: {
|
||
|
authorization: ws.secretKey,
|
||
|
},
|
||
|
method: "post",
|
||
|
body: JSON.stringify({
|
||
|
shardId,
|
||
|
data,
|
||
|
}),
|
||
|
}).catch(console.error);
|
||
|
}
|