fix(invite): add back channelId property (#7501)

This commit is contained in:
Rodry
2022-02-20 12:46:15 +00:00
committed by GitHub
parent 3baa340821
commit 78aa36f9f5
2 changed files with 16 additions and 2 deletions

View File

@@ -151,12 +151,24 @@ class Invite extends Base {
this.targetType ??= null;
}
if ('channel_id' in data) {
/**
* The id of the channel this invite is for
* @type {?Snowflake}
*/
this.channelId = data.channel_id;
}
if ('channel' in data) {
/**
* The channel this invite is for
* @type {?Channel}
*/
this.channel = this.client.channels._add(data.channel, this.guild, { cache: false });
this.channel =
this.client.channels._add(data.channel, this.guild, { cache: false }) ??
this.client.channels.resolve(this.channelId);
this.channelId ??= data.channel.id;
}
if ('created_at' in data) {
@@ -285,6 +297,7 @@ class Invite extends Base {
presenceCount: false,
memberCount: false,
uses: false,
channel: 'channelId',
inviter: 'inviterId',
guild: 'guildId',
});

View File

@@ -1381,7 +1381,8 @@ export class InteractionWebhook extends PartialWebhookMixin() {
export class Invite extends Base {
private constructor(client: Client, data: RawInviteData);
public channel: NonThreadGuildBasedChannel | PartialGroupDMChannel;
public channel: NonThreadGuildBasedChannel | PartialGroupDMChannel | null;
public channelId: Snowflake | null;
public code: string;
public get deletable(): boolean;
public get createdAt(): Date | null;