mirror of
https://github.com/discordeno/discordeno.git
synced 2026-06-16 03:18:17 +00:00
fix: remove basicShards and allowNextShard (#755)
This commit is contained in:
@@ -3,6 +3,7 @@ import { cache, cacheHandlers } from "../../cache.ts";
|
||||
import { structures } from "../../structures/mod.ts";
|
||||
import { DiscordGatewayPayload } from "../../types/gateway/gateway_payload.ts";
|
||||
import { DiscordGuild } from "../../types/guilds/guild.ts";
|
||||
import { ws } from "../../ws/ws.ts";
|
||||
|
||||
export async function handleGuildCreate(
|
||||
data: DiscordGatewayPayload,
|
||||
@@ -13,12 +14,12 @@ export async function handleGuildCreate(
|
||||
if (await cacheHandlers.has("guilds", payload.id)) return;
|
||||
|
||||
const guildStruct = await structures.createGuildStruct(
|
||||
data.d,
|
||||
payload,
|
||||
shardId,
|
||||
);
|
||||
await cacheHandlers.set("guilds", guildStruct.id, guildStruct);
|
||||
|
||||
const shard = basicShards.get(shardId);
|
||||
const shard = ws.shards.get(shardId);
|
||||
|
||||
if (shard?.unavailableGuildIds.has(payload.id)) {
|
||||
await cacheHandlers.delete("unavailableGuilds", payload.id);
|
||||
|
||||
@@ -2,6 +2,7 @@ import { eventHandlers } from "../../bot.ts";
|
||||
import { cacheHandlers } from "../../cache.ts";
|
||||
import { DiscordGatewayPayload } from "../../types/gateway/gateway_payload.ts";
|
||||
import { DiscordUnavailableGuild } from "../../types/guilds/unavailable_guild.ts";
|
||||
import { ws } from "../../ws/ws.ts";
|
||||
|
||||
export async function handleGuildDelete(
|
||||
data: DiscordGatewayPayload,
|
||||
@@ -15,7 +16,7 @@ export async function handleGuildDelete(
|
||||
await cacheHandlers.delete("guilds", payload.id);
|
||||
|
||||
if (payload.unavailable) {
|
||||
const shard = basicShards.get(shardId);
|
||||
const shard = ws.shards.get(shardId);
|
||||
if (shard) shard.unavailableGuildIds.add(payload.id);
|
||||
|
||||
await cacheHandlers.set("unavailableGuilds", payload.id, Date.now());
|
||||
|
||||
Reference in New Issue
Block a user