mirror of
https://github.com/discordjs/discord.js.git
synced 2026-03-09 16:13:31 +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;
|
||||
}
|
||||
|
||||
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',
|
||||
});
|
||||
|
||||
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 {
|
||||
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;
|
||||
|
||||
Reference in New Issue
Block a user