diff --git a/src/client/Client.js b/src/client/Client.js index 6c5b138..f1289ff 100644 --- a/src/client/Client.js +++ b/src/client/Client.js @@ -523,7 +523,7 @@ class Client extends BaseClient { */ /** - * Join this Guild using this invite + * Join this Guild / GroupDMChannel using this invite * @param {InviteResolvable} invite Invite code or URL * @param {AcceptInviteOptions} [options={ bypassOnboarding: true, bypassVerify: true }] Options * @returns {Promise} @@ -614,7 +614,7 @@ class Client extends BaseClient { } return guild; } else { - return this.channels.cache.has(i.channelId); + return this.channels.cache.has(i.channelId || data.channel?.id); } } diff --git a/src/structures/Invite.js b/src/structures/Invite.js index d308e7f..f42ff05 100644 --- a/src/structures/Invite.js +++ b/src/structures/Invite.js @@ -193,16 +193,16 @@ class Invite extends Base { if ('channel_id' in data) { /** * The channel's id this invite is for - * @type {Snowflake} + * @type {?Snowflake} */ this.channelId = data.channel_id; this.channel = this.client.channels.cache.get(data.channel_id); } - if ('channel' in data) { + if ('channel' in data && data.channel !== null) { /** * The channel this invite is for - * @type {Channel} + * @type {?Channel} */ this.channel ??= this.client.channels._add(data.channel, this.guild, { cache: false }); this.channelId ??= data.channel.id; diff --git a/typings/index.d.ts b/typings/index.d.ts index a985753..b33513b 100644 --- a/typings/index.d.ts +++ b/typings/index.d.ts @@ -1728,8 +1728,8 @@ export class InteractionWebhook extends PartialWebhookMixin() { export class Invite extends Base { private constructor(client: Client, data: RawInviteData); - public channel: NonThreadGuildBasedChannel | GroupDMChannel; - public channelId: Snowflake; + public channel?: NonThreadGuildBasedChannel | GroupDMChannel; + public channelId?: Snowflake; public code: string; public readonly deletable: boolean; public readonly createdAt: Date | null;