diff --git a/src/utils/delay.ts b/src/utils/delay.ts index d0c5de7..6fcb1ec 100644 --- a/src/utils/delay.ts +++ b/src/utils/delay.ts @@ -1,3 +1,3 @@ -export const delay = (ms: number) => new Promise((resolve, reject) => { +export const delay = async (ms: number): Promise => await new Promise((resolve, reject) => { setTimeout(() => resolve(true), ms); }); \ No newline at end of file diff --git a/src/utils/getChannelByType.ts b/src/utils/getChannelByType.ts index 428c083..5a8b83a 100644 --- a/src/utils/getChannelByType.ts +++ b/src/utils/getChannelByType.ts @@ -39,16 +39,16 @@ const getChannelByType = ( | undefined => { switch (data.type) { case ChannelTypes.GUILD_CATEGORY: - if(!guild) throw new Error("No Guild was provided to construct Channel") + if(guild === undefined) throw new Error("No Guild was provided to construct Channel") return new CategoryChannel(client, data as GuildChannelCategoryPayload, guild) case ChannelTypes.GUILD_NEWS: - if(!guild) throw new Error("No Guild was provided to construct Channel") + if(guild === undefined) throw new Error("No Guild was provided to construct Channel") return new NewsChannel(client, data as GuildNewsChannelPayload, guild) case ChannelTypes.GUILD_TEXT: - if(!guild) throw new Error("No Guild was provided to construct Channel") + if(guild === undefined) throw new Error("No Guild was provided to construct Channel") return new GuildTextChannel(client, data as GuildTextChannelPayload, guild) case ChannelTypes.GUILD_VOICE: - if(!guild) throw new Error("No Guild was provided to construct Channel") + if(guild === undefined) throw new Error("No Guild was provided to construct Channel") return new VoiceChannel(client, data as GuildVoiceChannelPayload, guild) case ChannelTypes.DM: return new DMChannel(client, data as DMChannelPayload)