mirror of
https://github.com/discordeno/discordeno.git
synced 2026-06-01 00:10:07 +00:00
22 lines
489 B
TypeScript
22 lines
489 B
TypeScript
import { delay } from "../util/utils.ts";
|
|
import { GatewayManager } from "./gateway_manager.ts";
|
|
|
|
/** Use this function to stop the gateway properly */
|
|
export async function stopGateway(
|
|
gateway: GatewayManager,
|
|
code = 3061,
|
|
reason = "Discordeno Testing Finished! Do Not RESUME!",
|
|
) {
|
|
// STOP WS
|
|
gateway.shards.forEach((shard) => {
|
|
clearInterval(shard.heartbeat.intervalId);
|
|
gateway.closeWS(
|
|
shard.ws,
|
|
code,
|
|
reason,
|
|
);
|
|
});
|
|
|
|
await delay(5000);
|
|
}
|