mirror of
https://github.com/discordjs/discord.js.git
synced 2026-03-16 19:43:29 +01:00
revert: refactor(invite): make channel a getter (#7365)
This commit is contained in:
@@ -151,16 +151,12 @@ class Invite extends Base {
|
|||||||
this.targetType ??= null;
|
this.targetType ??= null;
|
||||||
}
|
}
|
||||||
|
|
||||||
if ('channel_id' in data) {
|
if ('channel' in data) {
|
||||||
/**
|
/**
|
||||||
* The channel's id this invite is for
|
* The channel this invite is for
|
||||||
* @type {?Snowflake}
|
* @type {?Channel}
|
||||||
*/
|
*/
|
||||||
this.channelId = data.channel_id;
|
this.channel = this.client.channels._add(data.channel, this.guild, { cache: false });
|
||||||
}
|
|
||||||
|
|
||||||
if (data.channel) {
|
|
||||||
this.channelId ??= data.channel.id;
|
|
||||||
}
|
}
|
||||||
|
|
||||||
if ('created_at' in data) {
|
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
|
* The time the invite was created at
|
||||||
* @type {?Date}
|
* @type {?Date}
|
||||||
@@ -297,7 +284,6 @@ class Invite extends Base {
|
|||||||
presenceCount: false,
|
presenceCount: false,
|
||||||
memberCount: false,
|
memberCount: false,
|
||||||
uses: false,
|
uses: false,
|
||||||
channel: 'channelId',
|
|
||||||
inviter: 'inviterId',
|
inviter: 'inviterId',
|
||||||
guild: 'guildId',
|
guild: 'guildId',
|
||||||
});
|
});
|
||||||
|
|||||||
3
packages/discord.js/typings/index.d.ts
vendored
3
packages/discord.js/typings/index.d.ts
vendored
@@ -1365,8 +1365,7 @@ export class InteractionWebhook extends PartialWebhookMixin() {
|
|||||||
|
|
||||||
export class Invite extends Base {
|
export class Invite extends Base {
|
||||||
private constructor(client: Client, data: RawInviteData);
|
private constructor(client: Client, data: RawInviteData);
|
||||||
public readonly channel: NonThreadGuildBasedChannel | PartialGroupDMChannel;
|
public channel: NonThreadGuildBasedChannel | PartialGroupDMChannel;
|
||||||
public channelId: Snowflake | null;
|
|
||||||
public code: string;
|
public code: string;
|
||||||
public readonly deletable: boolean;
|
public readonly deletable: boolean;
|
||||||
public readonly createdAt: Date | null;
|
public readonly createdAt: Date | null;
|
||||||
|
|||||||
Reference in New Issue
Block a user