fix: stop gateway ts errors

This commit is contained in:
Skillz4Killz
2022-03-02 06:00:11 +00:00
committed by GitHub
parent 8ccf50ceff
commit 87dd8635ca
+21 -16
View File
@@ -1,16 +1,21 @@
/** Use this function to stop the gateway properly */ import { delay } from "../util/utils.ts";
export async function stopGateway(gateway: GatewayManager, code = 3061, reason = "Discordeno Testing Finished! Do Not RESUME!") { import { GatewayManager } from "./gateway_manager.ts";
// STOP WS /** Use this function to stop the gateway properly */
gateway.shards.forEach((shard) => { export async function stopGateway(
clearInterval(shard.heartbeat.intervalId); gateway: GatewayManager,
gateway.closeWS( code = 3061,
shard.ws, reason = "Discordeno Testing Finished! Do Not RESUME!",
code, ) {
// STOP WS
reason, gateway.shards.forEach((shard) => {
); clearInterval(shard.heartbeat.intervalId);
}); gateway.closeWS(
shard.ws,
await delay(5000); code,
} reason,
);
});
await delay(5000);
}