This commit is contained in:
Skillz4Killz
2022-03-30 23:00:22 +00:00
committed by GitHub
parent 2921b0ead0
commit 7ed30c61fc
2 changed files with 10 additions and 18 deletions

View File

@@ -1,10 +1,5 @@
import { Collection, createGatewayManager, createRestManager, endpoints } from "../../deps.ts";
import {
DISCORD_TOKEN,
EVENT_HANDLER_SECRET_KEY,
REST_AUTHORIZATION_KEY,
REST_PORT,
} from "../../configs.ts";
import { DISCORD_TOKEN, EVENT_HANDLER_SECRET_KEY, REST_AUTHORIZATION_KEY, REST_PORT } from "../../configs.ts";
// CREATE A SIMPLE MANAGER FOR REST
const rest = createRestManager({
@@ -43,8 +38,8 @@ async function startGateway() {
gateway.sessionStartLimitRemaining = result.sessionStartLimit.remaining;
gateway.sessionStartLimitResetAfter = result.sessionStartLimit.resetAfter;
gateway.maxConcurrency = result.sessionStartLimit.maxConcurrency;
gateway.maxShards = result.shards
gateway.lastShardId = result.shards
gateway.maxShards = result.shards;
gateway.lastShardId = result.shards;
// PREPARE BUCKETS FOR IDENTIFYING
gateway.prepareBuckets(gateway, 0, result.shards);
@@ -124,7 +119,6 @@ async function startGateway() {
startGateway();
setInterval(async () => {
console.log("GW DEBUG", "[Resharding] Checking if resharding is needed.");

View File

@@ -1,10 +1,4 @@
import {
BOT_ID,
DISCORD_TOKEN,
EVENT_HANDLER_PORT,
EVENT_HANDLER_SECRET_KEY,
EVENT_HANDLER_URL,
} from "../../configs.ts";
import { DISCORD_TOKEN, EVENT_HANDLER_PORT, EVENT_HANDLER_SECRET_KEY, EVENT_HANDLER_URL } from "../../configs.ts";
import { Collection, createGatewayManager, DiscordReady, GatewayManager, GetGatewayBot } from "../../deps.ts";
let gateway: GatewayManager;
@@ -53,7 +47,9 @@ function spawnGateway(shardId: number, options: Partial<GatewayManager>) {
}
// DONT SEND THESE EVENTS USELESS TO BOT
if (["GUILD_LOADED_DD"].includes(data.t)) return;
if (["GUILD_LOADED_DD"].includes(data.t)) {
return;
}
await fetch(`${EVENT_HANDLER_URL}:${EVENT_HANDLER_PORT}`, {
headers: {
@@ -67,7 +63,9 @@ function spawnGateway(shardId: number, options: Partial<GatewayManager>) {
}),
})
// BELOW IS FOR DENO MEMORY LEAK
.then((res) => res.text())
.then((res) =>
res.text()
)
.catch(() => null);
},
});