mirror of
https://github.com/discordeno/discordeno.git
synced 2026-06-02 17:00:08 +00:00
fix first handler
This commit is contained in:
@@ -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 {
|
||||
|
||||
@@ -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);
|
||||
}
|
||||
|
||||
@@ -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,
|
||||
|
||||
Reference in New Issue
Block a user