revert: refactor(invite): make channel a getter (#7365)

This commit is contained in:
Rodry
2022-01-31 16:10:32 +00:00
committed by GitHub
parent e6a26d25b3
commit 875c86a4ef
2 changed files with 5 additions and 20 deletions

View File

@@ -151,16 +151,12 @@ class Invite extends Base {
this.targetType ??= null;
}
if ('channel_id' in data) {
if ('channel' in data) {
/**
* The channel's id this invite is for
* @type {?Snowflake}
* The channel this invite is for
* @type {?Channel}
*/
this.channelId = data.channel_id;
}
if (data.channel) {
this.channelId ??= data.channel.id;
this.channel = this.client.channels._add(data.channel, this.guild, { cache: false });
}
if ('created_at' in data) {
@@ -197,15 +193,6 @@ class Invite extends Base {
}
}
/**
* The channel this invite is for
* @type {Channel}
* @readonly
*/
get channel() {
return this.client.channels.resolve(this.channelId);
}
/**
* The time the invite was created at
* @type {?Date}
@@ -297,7 +284,6 @@ class Invite extends Base {
presenceCount: false,
memberCount: false,
uses: false,
channel: 'channelId',
inviter: 'inviterId',
guild: 'guildId',
});

View File

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