From 5d97ce3b9c8d5fcd4bbc4deec65068c57df4e581 Mon Sep 17 00:00:00 2001 From: Skillz4Killz <23035000+Skillz4Killz@users.noreply.github.com> Date: Tue, 12 Oct 2021 19:25:15 +0000 Subject: [PATCH] fix first handler --- src/bot.ts | 6 ------ src/handlers/channels/CHANNEL_CREATE.ts | 4 ++-- src/transformers/channel.ts | 2 +- 3 files changed, 3 insertions(+), 9 deletions(-) diff --git a/src/bot.ts b/src/bot.ts index 0df32ba62..e4c1224b9 100644 --- a/src/bot.ts +++ b/src/bot.ts @@ -232,9 +232,6 @@ export async function startBot(bot: Bot) { // SETUP UTILS bot.utils = createUtils({}); - // SETUP CACHE - bot.users = new Collection(); - // START REST bot.rest = createRestManager({ token: bot.token }); @@ -365,9 +362,6 @@ export type Bot = CreatedBot & { rest: RestManager; gateway: GatewayManager; transformers: Transformers; - // TODO: Support async cache - users: Collection; - channels: Collection>; }; export interface Transformers { diff --git a/src/handlers/channels/CHANNEL_CREATE.ts b/src/handlers/channels/CHANNEL_CREATE.ts index 23934e1fb..eb1338979 100644 --- a/src/handlers/channels/CHANNEL_CREATE.ts +++ b/src/handlers/channels/CHANNEL_CREATE.ts @@ -5,8 +5,8 @@ import { SnakeCasedPropertiesDeep } from "../../types/util.ts"; import { Bot } from "../../bot.ts"; export async function handleChannelCreate(bot: Bot, payload: SnakeCasedPropertiesDeep) { - const channel = bot.transformers.channel(bot, payload.d as SnakeCasedPropertiesDeep); - await bot.channels.set(channel.id, channel); + const channel = bot.transformers.channel(bot, { channel: payload.d as SnakeCasedPropertiesDeep }); + await bot.cache.channels.set(channel.id, channel); bot.events.channelCreate(bot, channel); } diff --git a/src/transformers/channel.ts b/src/transformers/channel.ts index c790fe28a..7becee48f 100644 --- a/src/transformers/channel.ts +++ b/src/transformers/channel.ts @@ -6,7 +6,7 @@ import { DiscordOverwrite } from "../types/channels/overwrite.ts"; export function transformChannel( bot: Bot, payload: { channel: SnakeCasedPropertiesDeep } & { guildId?: bigint } -) { +): DiscordenoChannel { return { // UNTRANSFORMED STUFF HERE type: payload.channel.type,