mirror of
https://github.com/discordeno/discordeno.git
synced 2026-06-03 17:30:07 +00:00
fix(controllers/guilds): clear members in GUILD_DELETE event (#648)
* fix(controllers/guilds): clear members in GUILD_DELETE event * idk * idk * Update src/api/controllers/guilds.ts * Update src/api/controllers/guilds.ts * Update src/api/controllers/guilds.ts * Update src/api/controllers/guilds.ts * Update src/api/controllers/guilds.ts * Update src/api/controllers/guilds.ts * Update src/api/controllers/guilds.ts * deno fmt * Update src/api/controllers/guilds.ts Co-authored-by: ITOH <72305210+itohatweb@users.noreply.github.com> * deno fmt again * idk * Update src/api/controllers/guilds.ts Co-authored-by: ITOH <72305210+itohatweb@users.noreply.github.com> Co-authored-by: ITOH <72305210+itohatweb@users.noreply.github.com>
This commit is contained in:
@@ -9,7 +9,7 @@ import {
|
||||
} from "../../types/mod.ts";
|
||||
import { cache } from "../../util/cache.ts";
|
||||
import { Collection } from "../../util/collection.ts";
|
||||
import { structures } from "../structures/mod.ts";
|
||||
import { Member, structures } from "../structures/mod.ts";
|
||||
import { cacheHandlers } from "./cache.ts";
|
||||
|
||||
export async function handleInternalGuildCreate(
|
||||
@@ -48,6 +48,19 @@ export async function handleInternalGuildDelete(data: DiscordPayload) {
|
||||
}
|
||||
});
|
||||
|
||||
cacheHandlers.forEach("members", async (member) => {
|
||||
if (!member.guilds.has(payload.id)) return;
|
||||
|
||||
member.guilds.delete(payload.id);
|
||||
|
||||
if (!member.guilds.size) {
|
||||
await cacheHandlers.delete("members", member.id);
|
||||
return;
|
||||
}
|
||||
|
||||
await cacheHandlers.set("members", member.id, member);
|
||||
});
|
||||
|
||||
if (payload.unavailable) {
|
||||
return cacheHandlers.set("unavailableGuilds", payload.id, Date.now());
|
||||
}
|
||||
|
||||
Reference in New Issue
Block a user