mirror of
https://github.com/discordeno/discordeno.git
synced 2026-06-04 18:00:08 +00:00
fix: remove structure automatic caching (#517)
* fix: remove structure automatic caching * Update src/api/controllers/interactions.ts * Update src/api/controllers/interactions.ts * Update src/api/controllers/interactions.ts * memb -> member * rename shit * Update src/api/controllers/misc.ts Co-authored-by: ITOH <72305210+itohatweb@users.noreply.github.com> * idk * Update src/api/handlers/guild.ts Co-authored-by: ITOH <72305210+itohatweb@users.noreply.github.com> * fmt Co-authored-by: ITOH <72305210+itohatweb@users.noreply.github.com>
This commit is contained in:
@@ -7,7 +7,6 @@ import {
|
||||
import { cache } from "../../util/cache.ts";
|
||||
import { Collection } from "../../util/collection.ts";
|
||||
import { createNewProp } from "../../util/utils.ts";
|
||||
import { cacheHandlers } from "../controllers/cache.ts";
|
||||
import { sendMessage } from "../handlers/channel.ts";
|
||||
import { Guild } from "./guild.ts";
|
||||
import { Message } from "./message.ts";
|
||||
@@ -27,6 +26,7 @@ const baseChannel: Partial<Channel> = {
|
||||
},
|
||||
};
|
||||
|
||||
// deno-lint-ignore require-await
|
||||
export async function createChannel(
|
||||
data: ChannelCreatePayload,
|
||||
guildID?: string,
|
||||
@@ -63,7 +63,6 @@ export async function createChannel(
|
||||
nsfw: createNewProp(nsfw),
|
||||
});
|
||||
|
||||
await cacheHandlers.set("channels", data.id, channel);
|
||||
return channel as Channel;
|
||||
}
|
||||
|
||||
|
||||
@@ -1,7 +1,6 @@
|
||||
import { botID } from "../../bot.ts";
|
||||
import {
|
||||
BanOptions,
|
||||
ChannelCreatePayload,
|
||||
CreateGuildPayload,
|
||||
Emoji,
|
||||
GetAuditLogsOptions,
|
||||
@@ -12,12 +11,12 @@ import {
|
||||
ImageSize,
|
||||
MemberCreatePayload,
|
||||
Presence,
|
||||
RoleData,
|
||||
VoiceState,
|
||||
} from "../../types/mod.ts";
|
||||
import { cache } from "../../util/cache.ts";
|
||||
import { Collection } from "../../util/collection.ts";
|
||||
import { createNewProp } from "../../util/utils.ts";
|
||||
import { cacheHandlers } from "../controllers/cache.ts";
|
||||
import {
|
||||
ban,
|
||||
deleteServer,
|
||||
@@ -142,16 +141,15 @@ export async function createGuild(data: CreateGuildPayload, shardID: number) {
|
||||
...rest
|
||||
} = data;
|
||||
|
||||
const roles = (await Promise.all(
|
||||
data.roles.map((r: RoleData) => structures.createRole(r)),
|
||||
)) as Role[];
|
||||
|
||||
await Promise.all(
|
||||
channels.map((c: ChannelCreatePayload) =>
|
||||
structures.createChannel(c, data.id)
|
||||
),
|
||||
const roles = await Promise.all(
|
||||
data.roles.map((role) => structures.createRole(role)),
|
||||
);
|
||||
|
||||
await Promise.all(channels.map(async (channel) => {
|
||||
const channelStruct = await structures.createChannel(channel);
|
||||
return cacheHandlers.set("channels", channelStruct.id, channelStruct);
|
||||
}));
|
||||
|
||||
const restProps: Record<string, ReturnType<typeof createNewProp>> = {};
|
||||
for (const key of Object.keys(rest)) {
|
||||
// @ts-ignore index signature
|
||||
|
||||
@@ -124,8 +124,6 @@ export async function createMember(data: MemberCreatePayload, guildID: string) {
|
||||
mute: mute,
|
||||
});
|
||||
|
||||
await cacheHandlers.set("members", member.id, member);
|
||||
|
||||
return member as Member;
|
||||
}
|
||||
|
||||
|
||||
Reference in New Issue
Block a user