From 12691f2567acbc19f3ed1fb54bdeacdf8a82d406 Mon Sep 17 00:00:00 2001 From: ITOH Date: Thu, 27 May 2021 17:19:42 +0200 Subject: [PATCH] fix buggs --- src/bot.ts | 3 ++- src/cache.ts | 5 +++-- 2 files changed, 5 insertions(+), 3 deletions(-) diff --git a/src/bot.ts b/src/bot.ts index 637df063d..2f023e0a1 100644 --- a/src/bot.ts +++ b/src/bot.ts @@ -5,13 +5,14 @@ import { DiscordGatewayIntents } from "./types/gateway/gateway_intents.ts"; import { snowflakeToBigint } from "./util/bigint.ts"; import { GATEWAY_VERSION } from "./util/constants.ts"; import { ws } from "./ws/ws.ts"; +import { dispatchRequirements } from "./util/dispatch_requirements.ts"; // deno-lint-ignore prefer-const export let secretKey = ""; export let botId = 0n; export let applicationId = 0n; -export let eventHandlers: EventHandlers = {}; +export let eventHandlers: EventHandlers = { dispatchRequirements }; export let proxyWSURL = `wss://gateway.discord.gg`; diff --git a/src/cache.ts b/src/cache.ts index f765c5ec9..ab88f2537 100644 --- a/src/cache.ts +++ b/src/cache.ts @@ -62,7 +62,6 @@ export function guildSweeper(guild: DiscordenoGuild) { // This is inactive guild. Not a single thing has happened for atleast 30 minutes. // Not a reaction, not a message, not any event! - cache.guilds.delete(guild.id); cache.dispatchedGuildIds.add(guild.id); // Remove all channel if they were dispatched @@ -74,7 +73,9 @@ export function guildSweeper(guild: DiscordenoGuild) { }); // Reset activity for next interval - cache.activeGuildIds.clear(); + cache.activeGuildIds.delete(guild.id); + + return true; } export let cacheHandlers = {