mirror of
https://github.com/discordeno/discordeno.git
synced 2026-06-16 11:28:15 +00:00
Update READY.ts
This commit is contained in:
@@ -1,10 +1,7 @@
|
|||||||
import { eventHandlers, setApplicationId, setBotId } from "../../bot.ts";
|
import { eventHandlers, setApplicationId, setBotId } from "../../bot.ts";
|
||||||
import { cache, cacheHandlers } from "../../cache.ts";
|
import { cache } from "../../cache.ts";
|
||||||
import { initialMemberLoadQueue } from "../../structures/guild.ts";
|
|
||||||
import { structures } from "../../structures/mod.ts";
|
|
||||||
import type { DiscordGatewayPayload } from "../../types/gateway/gateway_payload.ts";
|
import type { DiscordGatewayPayload } from "../../types/gateway/gateway_payload.ts";
|
||||||
import type { Ready } from "../../types/gateway/ready.ts";
|
import type { Ready } from "../../types/gateway/ready.ts";
|
||||||
import type { GuildMemberWithUser } from "../../types/mod.ts";
|
|
||||||
import { snowflakeToBigint } from "../../util/bigint.ts";
|
import { snowflakeToBigint } from "../../util/bigint.ts";
|
||||||
import { ws } from "../../ws/ws.ts";
|
import { ws } from "../../ws/ws.ts";
|
||||||
|
|
||||||
@@ -92,28 +89,6 @@ async function loaded(shardId: number) {
|
|||||||
} else {
|
} else {
|
||||||
cache.isReady = true;
|
cache.isReady = true;
|
||||||
eventHandlers.ready?.();
|
eventHandlers.ready?.();
|
||||||
|
|
||||||
// All the members that came in on guild creates should now be processed 1 by 1
|
|
||||||
for (const [guildId, members] of initialMemberLoadQueue.entries()) {
|
|
||||||
eventHandlers.debug?.(
|
|
||||||
"loop",
|
|
||||||
"Running for of loop in READY file for loading members.",
|
|
||||||
);
|
|
||||||
await Promise.allSettled(
|
|
||||||
members.map(async (member) => {
|
|
||||||
const discordenoMember = await structures.createDiscordenoMember(
|
|
||||||
member as GuildMemberWithUser,
|
|
||||||
guildId,
|
|
||||||
);
|
|
||||||
|
|
||||||
return cacheHandlers.set(
|
|
||||||
"members",
|
|
||||||
discordenoMember.id,
|
|
||||||
discordenoMember,
|
|
||||||
);
|
|
||||||
}),
|
|
||||||
);
|
|
||||||
}
|
|
||||||
}
|
}
|
||||||
}
|
}
|
||||||
}
|
}
|
||||||
|
|||||||
Reference in New Issue
Block a user