fix first handler

This commit is contained in:
Skillz4Killz
2021-10-12 19:25:15 +00:00
committed by GitHub
parent 201732bc7d
commit 5d97ce3b9c
3 changed files with 3 additions and 9 deletions

View File

@@ -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<bigint, DiscordenoUser>;
channels: Collection<bigint, SnakeCasedPropertiesDeep<Channel>>;
};
export interface Transformers {

View File

@@ -5,8 +5,8 @@ import { SnakeCasedPropertiesDeep } from "../../types/util.ts";
import { Bot } from "../../bot.ts";
export async function handleChannelCreate(bot: Bot, payload: SnakeCasedPropertiesDeep<DiscordGatewayPayload>) {
const channel = bot.transformers.channel(bot, payload.d as SnakeCasedPropertiesDeep<Channel>);
await bot.channels.set(channel.id, channel);
const channel = bot.transformers.channel(bot, { channel: payload.d as SnakeCasedPropertiesDeep<Channel> });
await bot.cache.channels.set(channel.id, channel);
bot.events.channelCreate(bot, channel);
}

View File

@@ -6,7 +6,7 @@ import { DiscordOverwrite } from "../types/channels/overwrite.ts";
export function transformChannel(
bot: Bot,
payload: { channel: SnakeCasedPropertiesDeep<Channel> } & { guildId?: bigint }
) {
): DiscordenoChannel {
return {
// UNTRANSFORMED STUFF HERE
type: payload.channel.type,